TestDescription
public
final
class
TestDescription
extends Object
| java.lang.Object | |
| ↳ | com.android.tradefed.result.TestDescription |
Class representing information about a test case.
Summary
Fields | |
|---|---|
public
static
final
Pattern |
PARAMETERIZED_TEST_REGEX
Regex for method parameterized. |
Public constructors | |
|---|---|
TestDescription(String className, String testName)
Constructor |
|
TestDescription(String className, String testName, Annotation... annotations)
Constructor |
|
TestDescription(String className, String testName,
Constructor |
|
Public methods | |
|---|---|
int
|
compareTo(TestDescription o)
|
static
TestIdentifier
|
convertToIdentifier(TestDescription desc)
Create a |
static
TestDescription
|
createFromTestIdentifier(TestIdentifier testId)
Create a |
boolean
|
equals(Object obj)
|
static
TestDescription
|
fromString(String data)
Create a |
<T extends Annotation>
T
|
getAnnotation(Class<T> annotationType)
|
|
getAnnotations()
|
String
|
getClassName()
Returns the fully qualified class name of the test. |
String
|
getTestName()
Returns the name of the test with the parameters, if it's parameterized test. |
String
|
getTestNameWithoutParams()
Returns the name of the test without any parameters (if it's a parameterized method). |
int
|
hashCode()
|
String
|
toString()
|
Fields
PARAMETERIZED_TEST_REGEX
public static final Pattern PARAMETERIZED_TEST_REGEX
Regex for method parameterized. For example: testName[0]
Public constructors
TestDescription
public TestDescription (String className,
String testName)Constructor
| Parameters | |
|---|---|
className |
String: The name of the class holding the test. |
testName |
String: The test (method) name. |
TestDescription
public TestDescription (String className,
String testName,
Annotation... annotations)Constructor
| Parameters | |
|---|---|
className |
String: The name of the class holding the test. |
testName |
String: The test (method) name. |
annotations |
Annotation: List of ERROR(/Annotation) associated with the test case. |
TestDescription
public TestDescription (String className,
String testName,
annotations) Constructor
| Parameters | |
|---|---|
className |
String: The name of the class holding the test. |
testName |
String: The test (method) name. |
annotations |
: Collection of ERROR(/Annotation) associated with the test case. |
Public methods
convertToIdentifier
public static TestIdentifier convertToIdentifier (TestDescription desc)
Create a TestIdentifier from a TestDescription. Useful for converting a
description during testing.
| Parameters | |
|---|---|
desc |
TestDescription: The TestDescription to convert. |
| Returns | |
|---|---|
TestIdentifier |
The created TestIdentifier with the TestDescription values. |
createFromTestIdentifier
public static TestDescription createFromTestIdentifier (TestIdentifier testId)
Create a TestDescription from a TestIdentifier. Used for ease of conversion
from one to another.
| Parameters | |
|---|---|
testId |
TestIdentifier: The TestIdentifier to convert. |
| Returns | |
|---|---|
TestDescription |
the created TestDescription with the TestIdentifier values. |
equals
public boolean equals (Object obj)
| Parameters | |
|---|---|
obj |
Object |
| Returns | |
|---|---|
boolean |
|
fromString
public static TestDescription fromString (String data)
Create a TestDescription from its toString()} representation.
| Parameters | |
|---|---|
data |
String: the String representation. Expected format: classname#methodname |
| Returns | |
|---|---|
TestDescription |
the TestDescription or null if it could not be parsed |
getAnnotation
public T getAnnotation (Class<T> annotationType)
| Parameters | |
|---|---|
annotationType |
Class |
| Returns | |
|---|---|
T |
the annotation of type annotationType that is attached to this description node, or null if none exists |
getAnnotations
publicgetAnnotations ()
| Returns | |
|---|---|
|
all of the annotations attached to this description node |
getClassName
public String getClassName ()
Returns the fully qualified class name of the test.
| Returns | |
|---|---|
String |
|
getTestName
public String getTestName ()
Returns the name of the test with the parameters, if it's parameterized test. Returns the regular test name if not a parameterized test.
| Returns | |
|---|---|
String |
|
getTestNameWithoutParams
public String getTestNameWithoutParams ()
Returns the name of the test without any parameters (if it's a parameterized method).
| Returns | |
|---|---|
String |
|
hashCode
public int hashCode ()
| Returns | |
|---|---|
int |
|
toString
public String toString ()
| Returns | |
|---|---|
String |
|