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, 建構函式 | |
| 公用方法 | |
|---|---|
| 
        
        
        
        
        
        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
方法參數化的規則運算式。例如: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)集合。 | 
公用方法
convertToIdentifier
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 | |
fromString
public static TestDescription fromString (String data)
根據 toString()} 表示法建立 TestDescription。
| 參數 | |
|---|---|
| data | String:字串表示法。預期格式:classname#methodname | 
| 傳回 | |
|---|---|
| TestDescription | TestDescription,如果無法剖析則為空值 | 
getAnnotation
public T getAnnotation (Class<T> annotationType)
| 參數 | |
|---|---|
| annotationType | Class | 
| 傳回 | |
|---|---|
| T | 附加至此說明節點的 annotationType 類型註解,如果不存在,則傳回空值 | 
getAnnotations
publicgetAnnotations () 
| 傳回 | |
|---|---|
|  | 附加至此說明節點的所有註解 | 
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 | |
