[Windmill-dev] JS test suite or test setup/teardown
Matthew Eernisse
mde at osafoundation.org
Tue Dec 11 13:38:06 PST 2007
Howdy.
Looks like setup and teardown is something we need for the JS tests, and
relatively quickly, per bug 115:
http://windmill.osafoundation.org/trac/ticket/115
This is a problem for Cosmo tests because we need to test different
pieces of the app (e.g., PIM, admin), and run different setup code for
tests in the different pieces (e.g., the JS shortcuts for the UI
elements in the PIM).
Travis suggests something like:
namespace.setup = function () {};
namespace.teardown = function () {};
I think this syntax is fine. It's not quite the same thing as allowing
tests to have dependencies on other tests, but I think it covers the 80%
use case.
It also occurs to me that it might be nice to allow various tests to
share setup code, and allow them to to specify that the code run only
once versus every time.
Perhaps a separate property on the namespace object:
namespace.runSetupCodeOnlyOnce
It would be simple to let the framework keep track of which setup
functions have been executed.
You could of course hack this yourself by manually setting some sort of
property in your setup code, but it's really not a bunch of extra work
to implement the right way.
And alternative would be a different method you could call at the same
time as registerTests/registerTestNamespace that would do a global setup
for a set of tests, something like:
registerTestSuiteSetup
registerTestSuiteTeardown
Either of these would allow you to execute your desired code before your
tests run.
Thoughts?
Matthew
More information about the Windmill-dev
mailing list