ITestSuite

public abstract class ITestSuite
extends Object implements IRemoteTest, IDeviceTest, IMultiDeviceTest, IBuildReceiver, ISystemStatusCheckerReceiver, IShardableTest, ITestCollector, IInvocationContextReceiver, IRuntimeHintProvider, IMetricCollectorReceiver, IConfigurationReceiver, IReportNotExecuted, ITokenRequest

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


Abstract class used to run Test Suite. This class provide the base of how the Suite will be run. Each implementation can define the list of tests via the loadTests() method.

Summary

Nested classes

enum ITestSuite.RetryStrategy

The Retry Strategy to be used when re-running some tests. 

Fields

public static final String ABI_OPTION

public static final String MODULE_CHECKER_POST

public static final String MODULE_CHECKER_PRE

public static final String MODULE_METADATA_EXCLUDE_FILTER

public static final String MODULE_METADATA_INCLUDE_FILTER

public static final String PARAMETER_KEY

public static final String PREPARER_WHITELIST

public static final String PRIMARY_ABI_RUN

public static final String RUNNER_WHITELIST

public static final String SKIP_HOST_ARCH_CHECK

public static final String SKIP_SYSTEM_STATUS_CHECKER

public static final String TOKEN_KEY

Public constructors

ITestSuite()

Public methods

void addModuleMetadataExcludeFilters(MultiMap<String, String> filters)
void addModuleMetadataIncludeFilters(MultiMap<String, String> filters)
getAbis(ITestDevice device)

Gets the set of ABIs supported by both Compatibility testing AbiUtils#getAbisSupportedByCompatibility() and the device under test.

IBuildInfo getBuildInfo()

Implementation of ITestSuite may require the build info to load the tests.

ITestDevice getDevice()

Get the device under test.

ModuleDefinition getDirectModule()

Returns the ModuleDefinition to be executed directly, or null if none yet (when the ITestSuite has not been sharded yet).

final String getRequestedAbi()

Returns the abi requested with the option -a or --abi.

getRequiredTokens()

Returns the list of required tokens by the test.

long getRuntimeHint()

Return the expected runtime of the test in milliseconds.

abstract loadTests()

Abstract method to load the tests configuration that will be run.

void reportNotExecuted(ITestInvocationListener listener, String message)

Report the non-executed tests to the main listener provided.

void reportNotExecuted(ITestInvocationListener listener)

Report the non-executed tests to the main listener provided.

final void run(ITestInvocationListener listener)

Generic run method for all test loaded from loadTests().

void setAbiName(String abiName)

Set the value of mAbiName

void setBuild(IBuildInfo buildInfo)

void setCollectTestsOnly(boolean shouldCollectTest)

Run the test suite in collector only mode, this requires all the sub-tests to implements this interface too.

void setConfiguration(IConfiguration configuration)

Injects the IConfiguration in use.

void setDevice(ITestDevice device)

Inject the device under test.

void setDeviceInfos( deviceInfos)

void setInvocationContext(IInvocationContext invocationContext)

void setInvocationInjector(Injector injector)

Get the current Guice Injector from the invocation.

final void setMaxRunLimit(int maxRunLimit)

Set the max number of run attempt for each module.

void setMetricCollectors( collectors)

Sets the list of IMetricCollectors defined for the test run.

void setPrimaryAbiRun(boolean primaryAbiRun)

Set the value of mPrimaryAbiRun

void setShouldMakeDynamicModule(boolean dynamicModule)

When doing distributed sharding, we cannot have ModuleDefinition that shares tests in a pool otherwise intra-module sharding will not work, so we allow to disable it.

void setSystemStatusChecker( systemCheckers)

Sets the ISystemStatusCheckers from the configuration for the test.

split(int shardCountHint)

Alternative version of split() which also provides the shardCount that is attempted to be run.

Protected methods

createModuleListeners()

Returns the list of ITestInvocationListener applicable to the ModuleListener level.

boolean filterByConfigMetadata(IConfiguration config, MultiMap<String, String> include, MultiMap<String, String> exclude)

Apply the metadata filter to the config and see if the config should run.

boolean filterByRunnerType(IConfiguration config, allowedRunners)

Apply the Runner whitelist filtering, removing any runner that was not whitelisted.

getAbisForBuildTargetArch()

Return the abis supported by the Host build target architecture.

getHostAbis()

Returns the host machine abis.

Fields

ABI_OPTION

public static final String ABI_OPTION

MODULE_CHECKER_POST

public static final String MODULE_CHECKER_POST

MODULE_CHECKER_PRE

public static final String MODULE_CHECKER_PRE

MODULE_METADATA_EXCLUDE_FILTER

public static final String MODULE_METADATA_EXCLUDE_FILTER

MODULE_METADATA_INCLUDE_FILTER

public static final String MODULE_METADATA_INCLUDE_FILTER

PARAMETER_KEY

public static final String PARAMETER_KEY

PREPARER_WHITELIST

public static final String PREPARER_WHITELIST

PRIMARY_ABI_RUN

public static final String PRIMARY_ABI_RUN

RUNNER_WHITELIST

public static final String RUNNER_WHITELIST

SKIP_HOST_ARCH_CHECK

public static final String SKIP_HOST_ARCH_CHECK

SKIP_SYSTEM_STATUS_CHECKER

public static final String SKIP_SYSTEM_STATUS_CHECKER

TOKEN_KEY

public static final String TOKEN_KEY

Public constructors

ITestSuite

public ITestSuite ()

Public methods

addModuleMetadataExcludeFilters

public void addModuleMetadataExcludeFilters (MultiMap<String, String> filters)

Parameters
filters MultiMap

addModuleMetadataIncludeFilters

public void addModuleMetadataIncludeFilters (MultiMap<String, String> filters)

Parameters
filters MultiMap

getAbis

public  getAbis (ITestDevice device)

Gets the set of ABIs supported by both Compatibility testing AbiUtils#getAbisSupportedByCompatibility() and the device under test.

Parameters
device ITestDevice

Returns
The set of ABIs to run the tests on

Throws
DeviceNotAvailableException

getBuildInfo

public IBuildInfo getBuildInfo ()

Implementation of ITestSuite may require the build info to load the tests.

Returns
IBuildInfo

getDevice

public ITestDevice getDevice ()

Get the device under test.

Returns
ITestDevice the ITestDevice

getDirectModule

public ModuleDefinition getDirectModule ()

Returns the ModuleDefinition to be executed directly, or null if none yet (when the ITestSuite has not been sharded yet).

Returns
ModuleDefinition

getRequestedAbi

public final String getRequestedAbi ()

Returns the abi requested with the option -a or --abi.

Returns
String

getRequiredTokens

public  getRequiredTokens ()

Returns the list of required tokens by the test. Returns null if no token support.

Returns

getRuntimeHint

public long getRuntimeHint ()

Return the expected runtime of the test in milliseconds. The time is used to load balance sharded execution

Returns
long

loadTests

public abstract  loadTests ()

Abstract method to load the tests configuration that will be run. Each tests is defined by a IConfiguration and a unique name under which it will report results.

Returns

reportNotExecuted

public void reportNotExecuted (ITestInvocationListener listener, 
                String message)

Report the non-executed tests to the main listener provided. They should be reported as failed with the NOT_EXECUTED_FAILURE message.

Parameters
listener ITestInvocationListener: the main listener where to report the non-executed results.

message String: the message to be associated with the non-executed failure.

reportNotExecuted

public void reportNotExecuted (ITestInvocationListener listener)

Report the non-executed tests to the main listener provided. They should be reported as failed with the NOT_EXECUTED_FAILURE message.

Parameters
listener ITestInvocationListener: the main listener where to report the non-executed results.

run

public final void run (ITestInvocationListener listener)

Generic run method for all test loaded from loadTests().

Parameters
listener ITestInvocationListener: the ITestInvocationListener of test results

Throws
DeviceNotAvailableException

setAbiName

public void setAbiName (String abiName)

Set the value of mAbiName

Parameters
abiName String

setBuild

public void setBuild (IBuildInfo buildInfo)

Parameters
buildInfo IBuildInfo

setCollectTestsOnly

public void setCollectTestsOnly (boolean shouldCollectTest)

Run the test suite in collector only mode, this requires all the sub-tests to implements this interface too.

setConfiguration

public void setConfiguration (IConfiguration configuration)

Injects the IConfiguration in use.

Parameters
configuration IConfiguration

setDevice

public void setDevice (ITestDevice device)

Inject the device under test.

Parameters
device ITestDevice: the ITestDevice to use

setDeviceInfos

public void setDeviceInfos ( deviceInfos)

Parameters
deviceInfos

setInvocationContext

public void setInvocationContext (IInvocationContext invocationContext)

Parameters
invocationContext IInvocationContext

setInvocationInjector

public void setInvocationInjector (Injector injector)

Get the current Guice Injector from the invocation. It should allow us to continue the object injection of modules.

Parameters
injector Injector

setMaxRunLimit

public final void setMaxRunLimit (int maxRunLimit)

Set the max number of run attempt for each module.

Parameters
maxRunLimit int

setMetricCollectors

public void setMetricCollectors ( collectors)

Sets the list of IMetricCollectors defined for the test run.

Parameters
collectors

setPrimaryAbiRun

public void setPrimaryAbiRun (boolean primaryAbiRun)

Set the value of mPrimaryAbiRun

Parameters
primaryAbiRun boolean

setShouldMakeDynamicModule

public void setShouldMakeDynamicModule (boolean dynamicModule)

When doing distributed sharding, we cannot have ModuleDefinition that shares tests in a pool otherwise intra-module sharding will not work, so we allow to disable it.

Parameters
dynamicModule boolean

setSystemStatusChecker

public void setSystemStatusChecker ( systemCheckers)

Sets the ISystemStatusCheckers from the configuration for the test.

Parameters
systemCheckers

split

public  split (int shardCountHint)

Alternative version of split() which also provides the shardCount that is attempted to be run. This is useful for some test runner that cannot arbitrarly decide sometimes.

Parameters
shardCountHint int: the attempted shard count.

Returns
a collection of subtests to be executed separately or null if test is not currently shardable

Protected methods

createModuleListeners

protected  createModuleListeners ()

Returns the list of ITestInvocationListener applicable to the ModuleListener level. These listeners will be re-used for each module, they will not be re-instantiated so they should not assume an internal state.

Returns

filterByConfigMetadata

protected boolean filterByConfigMetadata (IConfiguration config, 
                MultiMap<String, String> include, 
                MultiMap<String, String> exclude)

Apply the metadata filter to the config and see if the config should run.

Parameters
config IConfiguration: The IConfiguration being evaluated.

include MultiMap: the metadata include filter

exclude MultiMap: the metadata exclude filter

Returns
boolean True if the module should run, false otherwise.

filterByRunnerType

protected boolean filterByRunnerType (IConfiguration config, 
                 allowedRunners)

Apply the Runner whitelist filtering, removing any runner that was not whitelisted. If a configuration has several runners, some might be removed and the config will still run.

Parameters
config IConfiguration: The IConfiguration being evaluated.

allowedRunners : The current runner whitelist.

Returns
boolean True if the configuration module is allowed to run, false otherwise.

getAbisForBuildTargetArch

protected  getAbisForBuildTargetArch ()

Return the abis supported by the Host build target architecture. Exposed for testing.

Returns

getHostAbis

protected  getHostAbis ()

Returns the host machine abis.

Returns