java.lang.Object | |
↳ | org.junit.runner.Description |
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 TestCase
s and TestSuite
s
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.
Fields | |||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|
EMPTY | Describes a Runner which runs no tests | ||||||||||
TEST_MECHANISM | Describes a step in the test-running mechanism that goes so wrong no other description can be used (for example, an exception thrown from a Runner's constructor |
Public Methods | |||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|
Add
Description as a child of the receiver. | |||||||||||
Create a
Description named after testClass | |||||||||||
Create a
Description named name . | |||||||||||
Create a
Description of a single test named name in the class clazz . | |||||||||||
Create a
Description of a single test named name in the class clazz . | |||||||||||
[Expand]
Inherited Methods | |||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|
![]() |
Describes a step in the test-running mechanism that goes so wrong no other description can be used (for example, an exception thrown from a Runner's constructor
Add Description
as a child of the receiver.
description | the soon-to-be child. |
---|
Create a Description
named after testClass
testClass | A Class containing tests |
---|
Description
of testClass
Create a Description
named name
.
Generally, you will add children to this Description
.
name | the name of the Description |
---|
Description
named name
Create a Description
of a single test named name
in the class clazz
.
Generally, this will be a leaf Description
.
clazz | the class of the test |
---|---|
name | the name of the test (a method name for test annotated with Test ) |
annotations | meta-data about the test, for downstream interpreters |
Description
named name
Create a Description
of a single test named name
in the class clazz
.
Generally, this will be a leaf Description
.
(This remains for binary compatibility with clients of JUnit 4.3)
clazz | the class of the test |
---|---|
name | the name of the test (a method name for test annotated with Test ) |
Description
named name
true
if the receiver is a suite
true
if the receiver is an atomic test