[Webtest] Design of com.canoo.webtest.steps.Step

Marc Guillemot webtest@lists.canoo.com
Wed, 30 Apr 2003 11:58:32 +0200


Hi,

I think in the class com.canoo.webtest.steps.Step, the method
execute(Context context) should be made final and should catch the
exceptions that may happen to throw a clean StepFailedException exception.

This means change:
-----------------------
    public void execute(Context context)  {
     expandProperties();
        notifyStarted(context);
        doExecute(context);
        notifyCompleted(context);
    }

-----------------------
to:
-----------------------
    public final void execute(Context context)  {
     try
     {
         expandProperties();
            notifyStarted(context);
            doExecute(context);
            notifyCompleted(context);
        }
        catch (Exception _e) {
            throw new StepFailedException(_e.getMessage(), this);
        }
    }
-----------------------

This would allow a testsuite to run even if one test throw an exception (in
my case a <followframe> became an http return code 500 and
com.meterware.httpunit.WebClient.validateHeaders throws an exception).

Any comment?

Marc.