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

用于参数化方法的正则表达式。例如: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) 的集合。

公共方法

compareTo

public int compareTo (TestDescription o)

参数
o TestDescription

返回
int

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 值。

等号

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

public  getAnnotations ()

返回
附加到此说明节点的所有注释

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