XUnit Tests
XML Applications
Release Notes
XUnit Tests
Orchextra Guide
License
Change History
NetKernel History
Acknowledgements

XUnit

XML Unit Test Application

XML Unit Tests

Unit testing is a valuable aspect of the development process. XML applications are no different and multiple small test cases help illustrate an application's datastructures, ensure robustness and provide quality assurance. XML Unit testing is very valuable to ensure long term maintainability of an application.

XUnit is an XML application for testing XML applications. It provides an extensible framework and test harness for executing unit tests.

XUnit consists of three components. autotest.idoc, pretest.idoc and testengine.idoc.

/xbin/test/xunit/testengine.idoc is the main unit test engine. It executes unit tests, validates and logs test results. testengine.idoc processes an XUnit test list parameter document with the following structure

<testlist iterate="1">
  <test>
    <uri xpathtest="/some/test/xpath">/some/test.idoc</uri>
  </test> . . .
</testlist>

XUnit iterates through the testlist executing each test in turn. If the optional xpathtest attribute is provided the xpath is evaluated against the result. Any failures and exceptions are logged and reported in the result.

/xbin/test/xunit/pretest.idoc is provided as a wrapper to the testengine.idoc. It validates testlist documents against the testlist relaxNG schema it also repeats the tests by the number specified in the iterate attribute of the testlist root.

Try the xunit tester unit test note this deliberately executes a test which fails in order to show the error reporting.

autotest.idoc is a utility for dynamically generating and then executing testlists. By default it is configured to build a testlist from all applications named test_*****.idoc. It is simple to subclass autotest.idoc to find other named files or to specify which application paths to test.

If you have the test module installed you can try the default autotest which runs all tests in the test package here.

It is straightforward to build sets of testlists and have them run by autotest.idoc or simply execute them directly using pretest.idoc.

(C) 2003, 1060 Research Limited
© 2003,2004, 1060® Research Limited
1060 registered trademark, NetKernel trademark of 1060 Research Limited