| java.lang.Object org.junit.runner.Description
Description | public class Description (Code) | | 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.TestCase s and
junit.framework.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.
See Also: org.junit.runner.Request See Also: org.junit.runner.Runner |
addChild | public void addChild(Description description)(Code) | | Add Description as a child of the receiver.
Parameters: description - the soon-to-be child. |
createSuiteDescription | public static Description createSuiteDescription(String name, Annotation... annotations)(Code) | | Create a Description named name .
Generally, you will add children to this Description .
Parameters: name - the name of the Description Parameters: annotations - a Description named name |
createSuiteDescription | public static Description createSuiteDescription(Class> testClass)(Code) | | Create a Description named after testClass
Parameters: testClass - A Class containing tests a Description of testClass |
createTestDescription | public static Description createTestDescription(Class> clazz, String name, Annotation... annotations)(Code) | | Create a Description of a single test named name in the class clazz .
Generally, this will be a leaf Description .
Parameters: clazz - the class of the test Parameters: name - the name of the test (a method name for test annotated with org.junit.Test) Parameters: annotations - meta-data about the test, for downstream interpreters a Description named name |
createTestDescription | public static Description createTestDescription(Class> clazz, String name)(Code) | | 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)
Parameters: clazz - the class of the test Parameters: name - the name of the test (a method name for test annotated with org.junit.Test) a Description named name |
getAnnotation | public T getAnnotation(Class<T> annotationType)(Code) | | |
getDisplayName | public String getDisplayName()(Code) | | a user-understandable label |
hashCode | public int hashCode()(Code) | | |
isEmpty | public boolean isEmpty()(Code) | | |
isSuite | public boolean isSuite()(Code) | | true if the receiver is a suite |
isTest | public boolean isTest()(Code) | | true if the receiver is an atomic test |
testCount | public int testCount()(Code) | | the total number of atomic tests in the receiver |
|
|