TestDescription

public final class TestDescription
extends Object implements Serializable

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, Collection<Annotation> annotations)

Constructor

Public methods

static TestIdentifier convertToIdentifier(TestDescription desc)

Create a TestIdentifier from a TestDescription.

static TestDescription createFromTestIdentifier(TestIdentifier testId)

Create a TestDescription from a TestIdentifier.

boolean equals(Object obj)
<T extends Annotation> T getAnnotation(Class<T> annotationType)
Collection<Annotation> 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 Annotation associated with the test case.

TestDescription

public TestDescription (String className, 
                String testName, 
                Collection<Annotation> annotations)

Constructor

Parameters
className String: The name of the class holding the test.

testName String: The test (method) name.

annotations Collection: Collection of 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

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

public Collection<Annotation> getAnnotations ()

Returns
Collection<Annotation> 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