TestDescription
public
final
class
TestDescription
extends Object
| java.lang.Object | |
| ↳ | com.android.tradefed.result.TestDescription |
表示测试用例相关信息的类。
摘要
字段 | |
|---|---|
public
static
final
Pattern |
PARAMETERIZED_TEST_REGEX
用于参数化方法的正则表达式。 |
公共构造函数 | |
|---|---|
TestDescription(String className, String testName)
构造函数 |
|
TestDescription(String className, String testName, Annotation... annotations)
构造函数 |
|
TestDescription(String className, String testName,
构造函数 |
|
公共方法 | |
|---|---|
int
|
compareTo(TestDescription o)
|
static
TestIdentifier
|
convertToIdentifier(TestDescription desc)
|
static
TestDescription
|
createFromTestIdentifier(TestIdentifier testId)
|
boolean
|
equals(Object obj)
|
static
TestDescription
|
fromString(String data)
从其 |
<T extends Annotation>
T
|
getAnnotation(Class<T> annotationType)
|
|
getAnnotations()
|
String
|
getClassName()
返回测试的完全限定类名称。 |
String
|
getTestName()
返回测试的名称及其参数(如果是参数化测试)。 |
String
|
getTestNameWithoutParams()
返回不带任何参数的测试名称(如果是参数化方法)。 |
int
|
hashCode()
|
String
|
toString()
|
字段
PARAMETERIZED_TEST_REGEX
public static final Pattern PARAMETERIZED_TEST_REGEX
用于参数化方法的正则表达式。例如:testName[0]
公共构造函数
TestDescription
public TestDescription (String className,
String testName)构造函数
| 参数 | |
|---|---|
className |
String:包含测试的类的名称。 |
testName |
String:测试(方法)名称。 |
TestDescription
public TestDescription (String className,
String testName,
Annotation... annotations)构造函数
| 参数 | |
|---|---|
className |
String:包含测试的类的名称。 |
testName |
String:测试(方法)名称。 |
annotations |
Annotation:与测试用例关联的 ERROR(/Annotation) 列表。 |
TestDescription
public TestDescription (String className,
String testName,
annotations) 构造函数
| 参数 | |
|---|---|
className |
String:包含测试的类的名称。 |
testName |
String:测试(方法)名称。 |
annotations |
:与测试用例关联的 ERROR(/Annotation) 集合。 |
公共方法
convertToIdentifier
public static TestIdentifier convertToIdentifier (TestDescription desc)
从 TestDescription 创建 TestIdentifier。在测试期间转换说明时非常有用。
| 参数 | |
|---|---|
desc |
TestDescription:要转换的 TestDescription。 |
| 返回 | |
|---|---|
TestIdentifier |
创建的 TestIdentifier,其中包含 TestDescription 值。 |
createFromTestIdentifier
public static TestDescription createFromTestIdentifier (TestIdentifier testId)
从 TestIdentifier 创建 TestDescription。用于便于从一种格式转换为另一种格式。
| 参数 | |
|---|---|
testId |
TestIdentifier:要转换的 TestIdentifier。 |
| 返回 | |
|---|---|
TestDescription |
创建的 TestDescription 及其 TestIdentifier 值。 |
equals
public boolean equals (Object obj)
| 参数 | |
|---|---|
obj |
Object |
| 返回 | |
|---|---|
boolean |
|
fromString
public static TestDescription fromString (String data)
基于 toString()} 表示法创建 TestDescription。
| 参数 | |
|---|---|
data |
String:字符串表示法。预期格式:classname#methodname |
| 返回 | |
|---|---|
TestDescription |
TestDescription,如果无法解析,则为 null |
getAnnotation
public T getAnnotation (Class<T> annotationType)
| 参数 | |
|---|---|
annotationType |
Class |
| 返回 | |
|---|---|
T |
附加在此说明节点上的类型为 annotationType 的注解;如果不存在,则为 null |
getAnnotations
publicgetAnnotations ()
| 返回 | |
|---|---|
|
附加在此说明节点的所有注释 |
getClassName
public String getClassName ()
返回测试的完全限定类名称。
| 返回 | |
|---|---|
String |
|
getTestName
public String getTestName ()
返回测试的名称及其参数(如果是参数化测试)。如果不是参数化测试,则返回常规测试名称。
| 返回 | |
|---|---|
String |
|
getTestNameWithoutParams
public String getTestNameWithoutParams ()
返回不带任何参数的测试名称(如果是参数化方法)。
| 返回 | |
|---|---|
String |
|
hashCode
public int hashCode ()
| 返回 | |
|---|---|
int |
|
toString
public String toString ()
| 返回 | |
|---|---|
String |
|