The problems experienced with the earlier versions of the test suite led us to approach the test suite for the new version of XForms in a totally different way.
Firstly, the test suite is now One Big XForm, that loads the details of the tests into an XForms instance, and uses that to drive the test suite interface, running the tests as sub-forms . The tests are divided over the chapters of the specification, and each chapter contains a test case for each feature, each test case containing any number of tests for that feature.
The interface allows you to step through the chapters, or to select a particular chapter, and for each chapter to step through the tests, or select a particular test.
Secondly, as far as possible, the tests are all self testing: apart from a description of what is being tested, and the output of the results, tests include a big green PASS or a big red FAIL indication at the top of the output, signifying whether the output values match with what was expected, with each individual failing test within that one test case also being flagged.
However, not all tests can be self-testing. Of course, for a language designed for user-interaction, some tests have to be based on physical interaction: for instance, does clicking on a button generate the correct event? But once you have confirmed it does indeed, subsequent tests can generate the activation event without user intervention.
Similarly, some tests can only be confirmed by inspection: does the
now()
function indeed generate today's date and time? Once you
have confirmed that, other tests that depend on the date and time can use that
function without further inspection.
Some tests are particularly introspective. Are expressions evaluated in the correct evaluation context? Such tests are particularly hard to formulate, since the very act of introspection alters the context that they are being evaluated in.
Finally, testing initialisation can be tricky, because before the system has initialised, there is little you can do.