测试说明

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, annotations) TestDescription (String className, String testName, annotations)

构造函数

公共方法

int compareTo ( TestDescription o)
static TestIdentifier convertToIdentifier ( TestDescription desc)

TestDescription创建TestIdentifier

static TestDescription createFromTestIdentifier (TestIdentifier testId)

TestIdentifier创建TestDescription

boolean equals (Object obj)
static TestDescription fromString (String data)

从其toString() } 表示形式创建一个TestDescription

<T extends Annotation> T getAnnotation (Class<T> annotationType)
getAnnotations ()
String getClassName ()

返回测试的完全限定类名。

String getTestName ()

如果是参数化测试,则返回带有参数的测试的名称。

String getTestNameWithoutParams ()

返回不带任何参数的测试名称(如果它是参数化方法)。

int hashCode ()
String toString ()

领域

参数化_测试_REGEX

public static final Pattern PARAMETERIZED_TEST_REGEX

参数化方法的正则表达式。例如:测试名称[0]

公共构造函数

测试说明

public TestDescription (String className, 
                String testName)

构造函数

参数
className String :举行测试的班级名称。

testName String :测试(方法)名称。

测试说明

public TestDescription (String className, 
                String testName, 
                Annotation... annotations)

构造函数

参数
className String :举行测试的班级名称。

testName String :测试(方法)名称。

annotations Annotation :与测试用例关联的ERROR(/Annotation)列表。

测试说明

public TestDescription (String className, 
                String testName, 
                 annotations)

构造函数

参数
className String :举行测试的班级名称。

testName String :测试(方法)名称。

annotations :与测试用例相关的ERROR(/Annotation)的集合。

公共方法

相比于

public int compareTo (TestDescription o)

参数
o TestDescription

退货
int

转换为标识符

public static TestIdentifier convertToIdentifier (TestDescription desc)

TestDescription创建TestIdentifier 。对于在测试期间转换描述很有用。

参数
desc TestDescription :要转换的TestDescription

退货
TestIdentifier使用 TestDescription 值创建的TestIdentifier

从测试标识符创建

public static TestDescription createFromTestIdentifier (TestIdentifier testId)

TestIdentifier创建TestDescription 。用于轻松从一种到另一种的转换。

参数
testId TestIdentifier :要转换的TestIdentifier

退货
TestDescription使用 TestIdentifier 值创建的TestDescription

等于

public boolean equals (Object obj)

参数
obj Object

退货
boolean

来自字符串

public static TestDescription fromString (String data)

从其toString() } 表示形式创建一个TestDescription

参数
data String :字符串表示形式。预期格式:类名#方法名

退货
TestDescription TestDescription 或 null(如果无法解析)

获取注释

public T getAnnotation (Class<T> annotationType)

参数
annotationType Class

退货
T附加到此描述节点的annotationType类型的注释,如果不存在则为 null

获取注释

public  getAnnotations ()

退货
附加到该描述节点的所有注释

获取类名

public String getClassName ()

返回测试的完全限定类名。

退货
String

获取测试名称

public String getTestName ()

如果是参数化测试,则返回带有参数的测试的名称。如果不是参数化测试,则返回常规测试名称。

退货
String

获取没有参数的测试名称

public String getTestNameWithoutParams ()

返回不带任何参数的测试名称(如果它是参数化方法)。

退货
String

哈希码

public int hashCode ()

退货
int

到字符串

public String toString ()

退货
String