ModuleDefinition

public class ModuleDefinition
extends Object implements Comparable<ModuleDefinition>, ITestCollector

java.lang.Object
   ↳ com.android.tradefed.testtype.suite.ModuleDefinition


Container for the test run configuration. This class is an helper to prepare and run the tests.

Summary

Constants

String MODULE_ABI

String MODULE_CONTROLLER

String MODULE_NAME

key names used for saving module info into IInvocationContext

String PREPARATION_TIME

String TEAR_DOWN_TIME

String TEST_TIME

Public constructors

ModuleDefinition(String name, Collection<IRemoteTest> tests, List<ITargetPreparer> preparers, List<IMultiTargetPreparer> multiPreparers, IConfiguration moduleConfig)

Constructor

Public methods

int compareTo(ModuleDefinition moduleDef)

String getId()

Return the unique module name.

IInvocationContext getModuleInvocationContext()

Returns the IInvocationContext associated with the module.

long getRuntimeHint()

Returns the approximate time to run all the tests in the module.

boolean hasModuleFailed()

Returns True if a testRunFailure has been called on the module *

int numTests()

Returns the current number of IRemoteTest waiting to be executed.

void run(ITestInvocationListener listener, TestFailureListener failureListener)

Run all the IRemoteTest contained in the module and use all the preparers before and after to setup and clean the device.

void run(ITestInvocationListener listener)

Run all the IRemoteTest contained in the module and use all the preparers before and after to setup and clean the device.

void setBuild(IBuildInfo build)

Inject the IBuildInfo to be used during the tests.

void setCollectTestsOnly(boolean collectTestsOnly)

Enables or disables test collection mode

void setDevice(ITestDevice device)

Inject the ITestDevice to be used during the tests.

void setDeviceInfos(Map<ITestDeviceIBuildInfo> deviceInfos)

Inject the Map of ITestDevice and IBuildInfo for the configuration.

String toString()

Protected methods

boolean hasTests()

Return True if the Module still has IRemoteTest to run in its pool.

Constants

MODULE_ABI

String MODULE_ABI

Constant Value: "module-abi"

MODULE_CONTROLLER

String MODULE_CONTROLLER

Constant Value: "module_controller"

MODULE_NAME

String MODULE_NAME

key names used for saving module info into IInvocationContext

Constant Value: "module-name"

PREPARATION_TIME

String PREPARATION_TIME

Constant Value: "PREP_TIME"

TEAR_DOWN_TIME

String TEAR_DOWN_TIME

Constant Value: "TEARDOWN_TIME"

TEST_TIME

String TEST_TIME

Constant Value: "TEST_TIME"

Public constructors

ModuleDefinition

ModuleDefinition (String name, 
                Collection<IRemoteTest> tests, 
                List<ITargetPreparer> preparers, 
                List<IMultiTargetPreparer> multiPreparers, 
                IConfiguration moduleConfig)

Constructor

Parameters
name String: unique name of the test configuration.

tests Collection: list of IRemoteTest that needs to run.

preparers List: list of ITargetPreparer to be used to setup the device.

multiPreparers List

moduleConfig IConfiguration: the IConfiguration of the underlying module config.

Public methods

compareTo

int compareTo (ModuleDefinition moduleDef)

Parameters
moduleDef ModuleDefinition

Returns
int

getId

String getId ()

Return the unique module name.

Returns
String

getModuleInvocationContext

IInvocationContext getModuleInvocationContext ()

Returns the IInvocationContext associated with the module.

Returns
IInvocationContext

getRuntimeHint

long getRuntimeHint ()

Returns the approximate time to run all the tests in the module.

Returns
long

hasModuleFailed

boolean hasModuleFailed ()

Returns True if a testRunFailure has been called on the module *

Returns
boolean

numTests

int numTests ()

Returns the current number of IRemoteTest waiting to be executed.

Returns
int

run

void run (ITestInvocationListener listener, 
                TestFailureListener failureListener)

Run all the IRemoteTest contained in the module and use all the preparers before and after to setup and clean the device.

Parameters
listener ITestInvocationListener: the ITestInvocationListener where to report results.

failureListener TestFailureListener: a particular listener to collect logs on testFail. Can be null.

Throws
DeviceNotAvailableException in case of device going offline.

run

void run (ITestInvocationListener listener)

Run all the IRemoteTest contained in the module and use all the preparers before and after to setup and clean the device.

Parameters
listener ITestInvocationListener: the ITestInvocationListener where to report results.

Throws
DeviceNotAvailableException in case of device going offline.

setBuild

void setBuild (IBuildInfo build)

Inject the IBuildInfo to be used during the tests.

Parameters
build IBuildInfo

setCollectTestsOnly

void setCollectTestsOnly (boolean collectTestsOnly)

Enables or disables test collection mode

setDevice

void setDevice (ITestDevice device)

Inject the ITestDevice to be used during the tests.

Parameters
device ITestDevice

setDeviceInfos

void setDeviceInfos (Map<ITestDeviceIBuildInfo> deviceInfos)

Inject the Map of ITestDevice and IBuildInfo for the configuration.

Parameters
deviceInfos Map

toString

String toString ()

Returns
String

Protected methods

hasTests

boolean hasTests ()

Return True if the Module still has IRemoteTest to run in its pool. False otherwise.

Returns
boolean