6.4. Reporting test results

To complete the JUnit cookbook, the recipe 'JUnit 2: How to report test results' describes how to modify the default mechanism of collecting and presenting test results. The design of the TestResult class relies on the Separation construction principle. Bear in mind the abstractly coupled JUnit classes TestCase and TestResult (see Figure 6.6). JUnit provides several subclasses of TestResult featuring textual or graphical output. However, other variants might be required, for example to save results to a database.

The definition of another TestResult variant is probably only done once in a JUnit adaptation. As this chapter concentrates mainly on demonstrating the feasibility of the cookbook approach in combination with ...

Get UML Profile for Framework Architectures, The now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.