[Webtest] [dev] refactoring
Marc Guillemot
webtest@lists.canoo.com
Thu, 04 Aug 2005 16:00:33 +0200
Dierk Koenig wrote:
> The internal state of a step consists of
> - information that only this step cares about,
> e.g. its attributes
> - information that is common for all steps
> and is of 'read only' nature, e.g. the testSpec
> - information that is shared, handed over from step
> to step, and is of 'read/write' nature.
> The latter is called the context and extracted into
> the Context class.
> This is the logic of the separation and it is reflected in the
> current object design.
this has perhaps been the intention but currently for instance:
- WebTestSpec contains the map of dynamic properties. According to your explaination, it should be in Context
- Context contains getNumberOfSteps() which is just a shortcut to get an info of the WebTestSpec
>
>>but as they are custom steps, we can't be aware of them. I guess
>>that the move from httpunit to htmlunit has broken
>>nearly all custom steps.
>
>
> Yes, and that was the downside of the otherwise important and useful
> change.
>
>
>>>We shouldn't do so
>>>without very good reason.
>>
>>is a good, well structured, design a good reason?
>
>
> It is, but IME collapsing Context does not improve the design.
if the distinction between Context and WebTestSpec isn't logical (and that's currently the case) the design would be
cleaner after a collapse. Nevertheless if the separation reaches a clean state I can reconsider my position.
>>we could imagine to have doExecute() default implementation call
>>doExecute(Context) which would be marked as deprecated.
>
>
> How could we keep a doExecute(Context) signature if there is no
> Context class any more?
this could be a first step.
I'm not 100% sure either that Context should be removed but quite unsatisfied with its current state / usage.
In fact I think that we should rather use execute() as start point for the execution of a step to handle in the future
normal ant tasks as well as webtest steps in the same way within a <webtest>.
Marc.