A Description describes a test which is to be run or has been run. Descriptions can
be atomic (a single test) or compound (containing children tests). Descriptions are used
to provide feedback about the tests that are about to run (for example, the tree view
visible in many IDEs) or tests that have been run (for example, the failures view).
Descriptions are implemented as a single class rather than a Composite because
they are entirely informational. They contain no logic aside from counting their tests.
In the past, we used the raw junit.framework.TestCases and junit.framework.TestSuites
to display the tree of tests. This was no longer viable in JUnit 4 because atomic tests no longer have a superclass below Object.
We needed a way to pass a class and name together. Description emerged from this.
Descriptiondescribes a test which is to be run or has been run.Descriptionscan be atomic (a single test) or compound (containing children tests).Descriptionsare used to provide feedback about the tests that are about to run (for example, the tree view visible in many IDEs) or tests that have been run (for example, the failures view).Descriptionsare implemented as a single class rather than a Composite because they are entirely informational. They contain no logic aside from counting their tests.In the past, we used the raw
junit.framework.TestCases andjunit.framework.TestSuites to display the tree of tests. This was no longer viable in JUnit 4 because atomic tests no longer have a superclass belowObject. We needed a way to pass a class and name together. Description emerged from this.