Listens for test results for a named test and outputs these in the standard JUnit XML format to the specified writer.
The API for this listener accepts notifications about different aspects of a tests results through different methods, so some assumption needs to be made as to which test result a notification refers to. For example {@link #startTest} will be called, then possibly {@link #timing} will be called, even though the test instance ispassed in both cases, it is not enough to distinguish a particular run of the test, as the test case instance may be being shared between multiple threads, or being run a repeated number of times, and can therfore be re-used between calls. The listeners make the assumption that, for every test, a unique thread will call {@link #startTest}and {@link #endTest} to delimit each test. All calls to set test parameters, timings, state and so on, will occurbetween the start and end and will be given with the same thread id as the start and end, so the thread id provides a unqiue value to identify a particular test run against.
CRC Card Responsibilities | Collaborations |
---|
Listen to test lifecycle notifications. |
Listen to test errors and failures. |
Listen to test timings. |
Listen to test memory usages. |
Listen to parameterized test parameters. |
Responsibilities |
---|
@todo Merge this class with CSV test listener, making the collection of results common to both, and only factoringout the results printing code into sub-classes. Provide a simple XML results formatter with the same format as the ant XML formatter, and a more structured one for outputing results with timings and summaries from performance tests.
@author Rupert Smith