to top
public class

HostTest

extends Object
implements IDeviceTest ITestFilterReceiver IRemoteTest @OptionClass(alias = "host")
java.lang.Object
   ↳ com.android.tradefed.testtype.HostTest

Class Overview

A test runner for JUnit host based tests. If the test to be run implements IDeviceTest this runner will pass a reference to the device.

Summary

Fields
private Set<String> mClasses @Option(name = "class", description = "The JUnit test classes to run, in the format .. eg. \"com.android.foo.Bar\". This field can be repeated.", importance = com.android.tradefed.config.Option.Importance.IF_UNSET)
private List<String> mKeyValueOptions @Option(name = "set-option", description = "Options to be passed down to the class under test, key and value should be separated by colon \":\"; for example, if class under test supports \"--iteration 1\" from a command line, it should be passed in as \"--set-option iteration:1\"; escaping of \":\" is currently not supported")
private String mMethodName @Option(name = "method", description = "The name of the method in the JUnit TestCase to run. eg. \"testFooBar\"", importance = com.android.tradefed.config.Option.Importance.IF_UNSET)
Public Constructors
HostTest()
Public Methods
void addAllExcludeFilters(List<String> filters)
Adds the List of filters of which tests to exclude.
void addAllIncludeFilters(List<String> filters)
Adds the List of filters of which tests to include.
void addExcludeFilter(String filter)
Adds a filter of which tests to exclude.
void addIncludeFilter(String filter)
Adds a filter of which tests to include.
int countTestCases()
ITestDevice getDevice()
Get the device under test.
void run(ITestInvocationListener listener)
Runs the tests, and reports result to the listener.
void setDevice(ITestDevice device)
Inject the device under test.
Protected Methods
List<Class<?>> getClasses()
Object loadObject(Class<?> classObj)
[Expand]
Inherited Methods
From class java.lang.Object
From interface com.android.tradefed.testtype.IDeviceTest
From interface com.android.tradefed.testtype.ITestFilterReceiver
From interface com.android.tradefed.testtype.IRemoteTest

Fields

private Set<String> mClasses

private List<String> mKeyValueOptions

private String mMethodName

Public Constructors

public HostTest ()

Public Methods

public void addAllExcludeFilters (List<String> filters)

Adds the List of filters of which tests to exclude.

Parameters
filters List

public void addAllIncludeFilters (List<String> filters)

Adds the List of filters of which tests to include.

Parameters
filters List

public void addExcludeFilter (String filter)

Adds a filter of which tests to exclude.

Parameters
filter String

public void addIncludeFilter (String filter)

Adds a filter of which tests to include.

Parameters
filter String

public int countTestCases ()

Returns
int

public ITestDevice getDevice ()

Get the device under test.

Returns
ITestDevice the ITestDevice

public void run (ITestInvocationListener listener)

Runs the tests, and reports result to the listener.

Parameters
listener ITestInvocationListener: the ITestInvocationListener of test results
Throws
DeviceNotAvailableException

public void setDevice (ITestDevice device)

Inject the device under test.

Parameters
device ITestDevice: the ITestDevice to use

Protected Methods

protected List<Class<?>> getClasses ()

Returns
List<Class<?>>
Throws
IllegalArgumentException

protected Object loadObject (Class<?> classObj)

Parameters
classObj Class
Returns
Object
Throws
IllegalArgumentException