測試說明
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 () |
領域
參數化_測試_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 。 |
從測試標識符創建
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 |
取得註釋
publicgetAnnotations ()
退貨 | |
---|---|
附加到該描述節點的所有註釋 |
取得類別名
public String getClassName ()
傳回測試的完全限定類別名稱。
退貨 | |
---|---|
String |
取得測試名稱
public String getTestName ()
如果是參數化測試,則傳回帶有參數的測試的名稱。如果不是參數化測試,則傳回常規測試名稱。
退貨 | |
---|---|
String |
取得沒有參數的測試名稱
public String getTestNameWithoutParams ()
傳回不帶任何參數的測試名稱(如果它是參數化方法)。
退貨 | |
---|---|
String |
哈希碼
public int hashCode ()
退貨 | |
---|---|
int |
到字串
public String toString ()
退貨 | |
---|---|
String |