NewsML Toolkit (1.1beta): Testing

Document Revision: $Revision: 1.3 $
Date: $Date: 2001/11/26 16:33:37 $

As explained in the architecture document, the NewsML Toolkit consists of a set of abstract interfaces (which the application uses), together with a concrete implementation using the Document Object Model (DOM) interface.

The DOM implementation comes with a more-or-less complete unit-testing suite, including tests for every method in the DOM implementation that is available through the abstract interfaces. Not only do these tests help to ensure that the library is running correctly and continues to run correctly after any code changes, but they act as a blueprint for the expected behaviour of each method: in fact, many of the unit tests were written before the methods they test.

Running the unit tests

  1. Ensure that you are using a Java2 (JDK 1.2) compatible Java development environment; if in doubt, read your documentation or get in touch with your vendor or maintainer.

  2. If you do not already have the open-source JUnit testing framework installed on your system, download it from

    http://www.junit.org/

    and add junit.jar to your CLASSPATH

  3. Ensure that all of the required libraries listed in Requirements are installed on your system and visible to Java.

  4. Add newsml-toolkit.jar from this distribution to your CLASSPATH.

  5. Run the entire unit-test suite (over 300 tests) with the top-level class org.newsml.toolkit.dom.unittests.NewsMLTestSuite. With a regular Java Development kit from Sun, try something like

    java junit.swingui.TestRunner org.newsml.toolkit.dom.unittests.NewsMLTestSuite
    

    (See the JUnit documentation for other alternatives.)

You can also run individual tests from the org.newsml.toolkit.dom package -- all classes with names ending in "Test" can be passed to the JUnit test runners.