junit.extensions.XTestSuite

The XTestSuite system allows programmers to conveniently manage test suites using simple XML expressions.


This software development tool is documented following the same natural course of it's creation. A variety of diagrams and notes were compiled that captured the essence of the programming problem in terms of design patterns, use cases, and acceptance test patterns (see the links on the left).


The latest code may be obtained by anonymous CVS. Please also feel free to submit queries or test-cases to vg103 (the project admin).


XTestSuite by Design

XTestSuite bridges functionality from the SAX and JUnit APIs by sub-classing at the standard extension points for each framework, e.g. Overview

XTestSuite.JUnitSAXHandler

Note: this nodule is not ready to be published.

XTestSuite.SetupTestSuite

SetupTestSuite should be examined in the context of the JUnit framework. It's purpose is to allow, in the input XML, junit:testsetup elements to behave just like junit:testsuite elements.
UML:SetupTestSuite

XTestSuite.TestResultAggregator

TestResultAggregator is a subclass of TestResult that also implements the TestListener interface. It works as a root listener, it aggregates all errors and failures, and also transforms captured standard output and error output in a test report XML document that is absolutely essential for debugging a faulty TestCase or setUp method.

XTestSuite.TestRunner

Note: this nodule is not ready to be published.

XTestSuite by Use Cases

use case:testRun
command syntax:
java junit.extensions.XTestSuite

[-r regression_level ]
[-o output_file.xml ]
files...

Capture Test Output

Test results, including the standard outut and standard error channels, are collected separately for each test. Also collected are JUnit TestFailure structures which provide details on errors and failures within the context of each individual test. The state of a test run is captured in an XML document then

rendered to either HTML or RSS/RDF. Sample Test Run in HTML

XTestSuite by Acceptance Test Patterns

Acceptance tests were written in XML that expressed each hook in the XML input files. The raw tests, in XML, are linked on the left, and are a good way to view what you can do with XTestSuite.

Test 1: Single TestCase

This testcase encapsulates an entire JUnit test run into a single test. The generic pattern used is to run the tests, and then apply various asserts to constrain the expected runCount, errorCount, and failureCount.


This particular TestCase merely tests that it has been initialised by a TestSetup class, so, in this case, it is expected to run one test, produce one failure, and zero errors.
<junit:testsuite 
    xmlns:junit='http://xtestsuite.sourceforge.net/junit'
    id='SingleTestCase'>
    <junit:testsuite
        test-class='junit.extensions.xtestsuite.abtests.TestA'/>
        
</junit:testsuite>

Test 2: JUnit MoneyTest I

<junit:testsuite 
    xmlns:junit='http://xtestsuite.sourceforge.net/junit'
    id='MoneyTest'>
    <junit:testcase
        test-class='junit.samples.money.MoneyTest'
        description='Loads the sample JUnit TestCase `MoneyTest`.'
        />
</junit:testsuite>

Test 3: CollectTests

This test scans the CLASSPATH for subclasses of junit.framework.TestCase. The search is conducted only in the package identified by the collect-tests attribute, and, the tests are enclosed in a TestSuite which is given the name of the package as well. This test succeeds if there are more than zero tests run, and there are zero errors (failures, like the A class not being initialized correctly, are ignored).
    <junit:testsuite 
        xmlns:junit='http://xtestsuite.sourceforge.net/junit'
        id='Collector'>
        <junit:testsetup 
          setup-class='junit.extensions.xtestsuite.abtests.TestSetupA'>
            <junit:testsuite 
              collect-tests='junit.extensions.xtestsuite.abtests'/>
        </junit:testsetup>
    </junit:testsuite>

Test 4: TestSetup

<junit:testsuite 
    xmlns:junit='http://xtestsuite.sourceforge.net/junit'
    id='TestSetup'>
    <junit:testsetup
        setup-class='junit.extensions.xtestsuite.abtests.TestSetupA'>
        <junit:testsuite test-class='junit.extensions.xtestsuite.abtests.TestA'/>
    </junit:testsetup>
</junit:testsuite>

Test 5: Logging

                Note: this nodule is <b>not</b> ready to be published.
                

Test 6: Graceful Failure

                Note: this nodule is <b>not</b> ready to be published.
                

Test 7: Bootstrap.0

                Note: this nodule is <b>not</b> ready to be published.