ModuleDefinition

public class ModuleDefinition
extends Object implements 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

Fields

public static final String MODULE_ABI

public static final String MODULE_CONTROLLER

public static final String MODULE_ID

Module ID the name that will be used to identify uniquely the module during testRunStart.

public static final String MODULE_NAME

Module name is the base name associated with the module, usually coming from the Xml TF config file the module was loaded from.

public static final String PREPARATION_TIME

public static final String RETRY_FAIL_COUNT

public static final String RETRY_SUCCESS_COUNT

public static final String RETRY_TIME

public static final String TEAR_DOWN_TIME

public static final String TEST_TIME

Public constructors

ModuleDefinition(String name, tests, preparersPerDevice, 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.

getRequiredTokens()
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.

final void reportNotExecuted(ITestInvocationListener listener, String message)

Report completely not executed modules.

final void run(ITestInvocationListener listener, moduleLevelListeners, TestFailureListener failureListener)

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

final 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.

final void run(ITestInvocationListener listener, moduleLevelListeners, TestFailureListener failureListener, int maxRunLimit)

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( deviceInfos)

Inject the ERROR(/Map) of ITestDevice and IBuildInfo for the configuration.

void setLogSaver(ILogSaver logSaver)

Pass the invocation log saver to the module so it can use it if necessary.

void setMetricCollectors( collectors)

Inject the List of IMetricCollector to be used by the module.

final void setRebootAtLastRetry(boolean rebootAtLastRetry)

Sets the flag to reboot devices at the last intra-module retry.

final void setRetryStrategy(ITestSuite.RetryStrategy retryStrategy, boolean mergeAttempts)

Sets the RetryStrategy to be used when retrying.

String toString()

Protected methods

boolean hasTests()

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

Fields

MODULE_ABI

public static final String MODULE_ABI

MODULE_CONTROLLER

public static final String MODULE_CONTROLLER

MODULE_ID

public static final String MODULE_ID

Module ID the name that will be used to identify uniquely the module during testRunStart. It will usually be a combination of MODULE_ABI + MODULE_NAME.

MODULE_NAME

public static final String MODULE_NAME

Module name is the base name associated with the module, usually coming from the Xml TF config file the module was loaded from.

PREPARATION_TIME

public static final String PREPARATION_TIME

RETRY_FAIL_COUNT

public static final String RETRY_FAIL_COUNT

RETRY_SUCCESS_COUNT

public static final String RETRY_SUCCESS_COUNT

RETRY_TIME

public static final String RETRY_TIME

TEAR_DOWN_TIME

public static final String TEAR_DOWN_TIME

TEST_TIME

public static final String TEST_TIME

Public constructors

ModuleDefinition

public ModuleDefinition (String name, 
                 tests, 
                 preparersPerDevice, 
                 multiPreparers, 
                IConfiguration moduleConfig)

Constructor

Parameters
name String: unique name of the test configuration.

tests : list of IRemoteTest that needs to run.

preparersPerDevice : list of ITargetPreparer to be used to setup the device.

multiPreparers

moduleConfig IConfiguration: the IConfiguration of the underlying module config.

Public methods

compareTo

public int compareTo (ModuleDefinition moduleDef)

Parameters
moduleDef ModuleDefinition

Returns
int

getId

public String getId ()

Return the unique module name.

Returns
String

getModuleInvocationContext

public IInvocationContext getModuleInvocationContext ()

Returns the IInvocationContext associated with the module.

Returns
IInvocationContext

getRequiredTokens

public  getRequiredTokens ()

Returns

getRuntimeHint

public long getRuntimeHint ()

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

Returns
long

hasModuleFailed

public boolean hasModuleFailed ()

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

Returns
boolean

numTests

public int numTests ()

Returns the current number of IRemoteTest waiting to be executed.

Returns
int

reportNotExecuted

public final void reportNotExecuted (ITestInvocationListener listener, 
                String message)

Report completely not executed modules.

Parameters
listener ITestInvocationListener

message String

run

public final void run (ITestInvocationListener listener, 
                 moduleLevelListeners, 
                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.

moduleLevelListeners : The list of listeners at the module level.

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

Throws
DeviceNotAvailableException in case of device going offline.

run

public final 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.

run

public final void run (ITestInvocationListener listener, 
                 moduleLevelListeners, 
                TestFailureListener failureListener, 
                int maxRunLimit)

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.

moduleLevelListeners : The list of listeners at the module level.

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

maxRunLimit int: the max number of runs for each testcase.

Throws
DeviceNotAvailableException in case of device going offline.

setBuild

public void setBuild (IBuildInfo build)

Inject the IBuildInfo to be used during the tests.

Parameters
build IBuildInfo

setCollectTestsOnly

public void setCollectTestsOnly (boolean collectTestsOnly)

Enables or disables test collection mode

setDevice

public void setDevice (ITestDevice device)

Inject the ITestDevice to be used during the tests.

Parameters
device ITestDevice

setDeviceInfos

public void setDeviceInfos ( deviceInfos)

Inject the ERROR(/Map) of ITestDevice and IBuildInfo for the configuration.

Parameters
deviceInfos

setLogSaver

public void setLogSaver (ILogSaver logSaver)

Pass the invocation log saver to the module so it can use it if necessary.

Parameters
logSaver ILogSaver

setMetricCollectors

public void setMetricCollectors ( collectors)

Inject the List of IMetricCollector to be used by the module.

Parameters
collectors

setRebootAtLastRetry

public final void setRebootAtLastRetry (boolean rebootAtLastRetry)

Sets the flag to reboot devices at the last intra-module retry.

Parameters
rebootAtLastRetry boolean

setRetryStrategy

public final void setRetryStrategy (ITestSuite.RetryStrategy retryStrategy, 
                boolean mergeAttempts)

Sets the RetryStrategy to be used when retrying.

Parameters
retryStrategy ITestSuite.RetryStrategy

mergeAttempts boolean

toString

public String toString ()

Returns
String

Protected methods

hasTests

protected boolean hasTests ()

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

Returns
boolean