|
|
|||||||||
| 上一个类 下一个类 | 框架 无框架 | ||||||||
| 摘要: 嵌套 | 字段 | 构造器 | 方法 | 详细信息: 字段 | 构造器 | 方法 | ||||||||
org.junit.runner Class Description
java.lang.Objectorg.junit.runner.Description
public class 详细描述
- extends Object
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 TestCases and 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.
| 字段摘要 | |
|---|---|
static Description |
EMPTY
Describes a Runner which runs no tests |
static Description |
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 |
| 方法摘要 | |
|---|---|
void |
addChild(Description description)
Add Description as a child of the receiver. |
Description |
childlessCopy()
|
static Description |
createSuiteDescription(Class<?> testClass)
Create a Description named after testClass |
static Description |
createSuiteDescription(String name,
Annotation... annotations)
Create a Description named name. |
static Description |
createTestDescription(Class<?> clazz,
String name)
Create a Description of a single test named name in the class clazz. |
static Description |
createTestDescription(Class<?> clazz,
String name,
Annotation... annotations)
Create a Description of a single test named name in the class clazz. |
boolean |
equals(Object obj)
|
<T extends Annotation>
|
|
getAnnotation(Class<T> annotationType)
Collection<Annotation>getAnnotations()
ArrayList<Description>getChildren()
StringgetClassName()
StringgetDisplayName()
StringgetMethodName()
Class<?>getTestClass()
inthashCode()
booleanisEmpty()
booleanisSuite()
booleanisTest()
inttestCount()
StringtoString()
| 类方法继承: java.lang.Object |
|---|
clone, finalize, getClass, notify, notifyAll, wait, wait, wait |
| 字段详细信息 |
|---|
EMPTY
public static final Description EMPTY
- Describes a Runner which runs no tests
TEST_MECHANISM
public static final Description 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
| 方法详细信息 |
|---|
createSuiteDescription
public static Description createSuiteDescription(String name, Annotation... annotations)
- Create a
Descriptionnamedname. Generally, you will add children to thisDescription. - 参数:
name- the name of theDescriptionannotations-- 返回:
- a
Descriptionnamedname
createTestDescription
public static Description createTestDescription(Class<?> clazz, String name, Annotation... annotations)
- Create a
Descriptionof a single test namednamein the classclazz. Generally, this will be a leafDescription. - 参数:
clazz- the class of the testname- the name of the test (a method name for test annotated withTest)annotations- meta-data about the test, for downstream interpreters- 返回:
- a
Descriptionnamedname
createTestDescription
public static Description createTestDescription(Class<?> clazz, String name)
- Create a
Descriptionof a single test namednamein the classclazz. Generally, this will be a leafDescription. (This remains for binary compatibility with clients of JUnit 4.3) - 参数:
clazz- the class of the testname- the name of the test (a method name for test annotated withTest)- 返回:
- a
Descriptionnamedname
createSuiteDescription
public static Description createSuiteDescription(Class<?> testClass)
- Create a
Descriptionnamed aftertestClass - 参数:
testClass- AClasscontaining tests- 返回:
- a
DescriptionoftestClass
getDisplayName
public String getDisplayName()
- 返回:
- a user-understandable label
addChild
public void addChild(Description description)
- Add
Descriptionas a child of the receiver. - 参数:
description- the soon-to-be child.
getChildren
public ArrayList<Description> getChildren()
- 返回:
- the receiver's children, if any
isSuite
public boolean isSuite()
- 返回:
trueif the receiver is a suite
isTest
public boolean isTest()
- 返回:
trueif the receiver is an atomic test
testCount
public int testCount()
- 返回:
- the total number of atomic tests in the receiver
hashCode
public int hashCode()
equals
public boolean equals(Object obj)
toString
public String toString()
isEmpty
public boolean isEmpty()
- 返回:
- true if this is a description of a Runner that runs no tests
childlessCopy
public Description childlessCopy()
- 返回:
- a copy of this description, with no children (on the assumption that some of the children will be added back)
getAnnotation
public <T extends Annotation> T getAnnotation(Class<T> annotationType)
- 返回:
- the annotation of type annotationType that is attached to this description node, or null if none exists
getAnnotations
public Collection<Annotation> getAnnotations()
- 返回:
- all of the annotations attached to this description node
getTestClass
public Class<?> getTestClass()
- 返回:
- If this describes a method invocation, the class of the test instance.
getClassName
public String getClassName()
- 返回:
- If this describes a method invocation, the name of the class of the test instance
getMethodName
public String getMethodName()
- 返回:
- If this describes a method invocation, the name of the method (or null if not)
|
|
|||||||||
| 上一个类 下一个类 | 框架 无框架 | ||||||||
| 摘要: 嵌套 | 字段 | 构造器 | 方法 | 详细信息: 字段 | 构造器 | 方法 | ||||||||
org.junit.runner.Description