6.1. An overview of JUnit

JUnit allows programmers to define tests in a compact way, to reuse code in related test cases, to compose test cases into test suites, and to manipulate and visualize test results. The goal of JUnit is to reduce the amount of code that has to be written by a developer who wants to test Java applications. The following are the main parts of the framework.

  • Test cases: each test case describes one particular test. Adding new test cases is the most frequent JUnit adaptation. JUnit provides the TestCase class, which defines a standard interface for test cases. TestCase is the most important abstraction in JUnit.

  • Test suites: the number of test cases can grow quickly, thus JUnit allows test cases to be composed into test ...

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.