测试说明

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 ()

字段

PARAMETERIZED_TEST_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

createFromTestIdentifier

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 :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

getTestNameWithoutParams

public String getTestNameWithoutParams ()

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

退货
String

哈希码

public int hashCode ()

退货
int

到字符串

public String toString ()

退货
String