[Webtest] Latest Refactorings and Rationale, Build 256/257

Dierk Koenig webtest@lists.canoo.com
Fri, 15 Nov 2002 11:00:45 +0100


Carsten and I did some refactorings in that build in order to
tackle the "convolution" issue (hi, donald :-) and to 
furthermore prepare for the JS support and for the
"TaskContainer" refactoring that will allow for nesting
arbitrary Tasks in the Steps area.

The observable behaviour of the system did not change. It
is all about internal restructurings.

1) Renamings

old						new
----						----
AbstractTestStepSpecification		Step
TestConfig					Configuration
TestContext					Context
TestSpecification				WebTest
TestStepFailedError			StepFailedException
TestStepSetupError			StepExecutionException

some renamings in the "self" package where classes that
are only used from within a selftest (unit test) now
bear a trailing "Stub".

Rationale: we had a proliferation of the word "Test",
sometimes denoting a selftest (unit test) of the system and
the WebTest at other times. We now try to reserve this term
for unit tests only (AllTests, BlaTest).
One exception: WebTest.

2) Junit dependencies to WebTest

Reusing functionality of junit.framework.TestCase for
running through the Steps was a major cause for the
Removing that dependency allowed for much easier 
implementation at the price of having a small, little,
tiny, hardly invisible, almost transparent duplication
with TestCase.run(). Carsten did convince me that this
solution is much better.

The engine package now works like this:

Processing is done by the Engine class.
It cares for executing all the Steps and contains
the logic when to stop processing. It returns
a single ResultInfo object.

A Context is passed to every Step at
execution time. The Context contains all state that
needs to passed from one Step to the next, e.g.
the last httpunit WebResponse. You can think of it
as a "Browser" instance (although it does a little more).

A Configuration is everything you specify
in a <config> element, providing some defaults.

A WebTest aggregates a Configuration and a
collection of Steps. It also has an id for

[Reporting was adapted to the new abstractions
but did not change in structure.]

3) Still not perfect

TestSpecificationTask is the ant task wrapper for 
a WebTest. It is about to be renamed to "WebTestTask".
As this would break the taskdefs for all the tests
out there, we will first go for transparent
taskdefs and doing that change later on, while still
keeping the old class as a proxy for a while to ensure
backward compatibility.

The same applies to renaming <testSpec> to <webtest>.

so much for now