測試說明
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) |
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
參數化方法的正則表達式。例如:測試名[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 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 |
獲取註解
publicgetAnnotations ()
退貨 | |
---|---|
附加到此描述節點的所有註釋 |
獲取類名
public String getClassName ()
返回測試的完全限定類名。
退貨 | |
---|---|
String |
獲取測試名
public String getTestName ()
如果是參數化測試,則返回帶有參數的測試名稱。如果不是參數化測試,則返回常規測試名稱。
退貨 | |
---|---|
String |
getTestNameWithoutParams
public String getTestNameWithoutParams ()
返回不帶任何參數的測試名稱(如果它是參數化方法)。
退貨 | |
---|---|
String |
哈希碼
public int hashCode ()
退貨 | |
---|---|
int |
到字符串
public String toString ()
退貨 | |
---|---|
String |