ITestSuite

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

java.lang.Object
   ↳ com.android.tradefed.testtype.suite.ITestSuite
Known Direct Subclasses
AtestRunner Implementation of ITestSuite  
TfSuiteRunner Implementation of ITestSuite which will load tests from TF jars res/config/suite/ folder. 


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

Constants

String ABI_OPTION

String MODULE_CHECKER_POST

String MODULE_CHECKER_PRE

String PRIMARY_ABI_RUN

String SKIP_HOST_ARCH_CHECK

Public constructors

ITestSuite()

Public methods

final Set<IAbi> getAbis(ITestDevice device)

Gets the set of ABIs supported by both Compatibility testing 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.

long getRuntimeHint()

Return the expected runtime of the test in milliseconds.

abstract LinkedHashMap<String, IConfiguration> loadTests()

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

final void run(ITestInvocationListener listener)

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

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 setDevice(ITestDevice device)

Inject the device under test.

void setInvocationContext(IInvocationContext invocationContext)

void setMetricCollectors(List<IMetricCollector> collectors)

Sets the list of IMetricCollectors defined for the test run.

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(List<ISystemStatusChecker> systemCheckers)

Sets the ISystemStatusCheckers from the configuration for the test.

Collection<IRemoteTest> split(int shardCountHint)

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

Protected methods

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.

Set<String> getAbisForBuildTargetArch()

Return the abis supported by the Host build target architecture.

Constants

ABI_OPTION

String ABI_OPTION

Constant Value: "abi"

MODULE_CHECKER_POST

String MODULE_CHECKER_POST

Constant Value: "PostModuleChecker"

MODULE_CHECKER_PRE

String MODULE_CHECKER_PRE

Constant Value: "PreModuleChecker"

PRIMARY_ABI_RUN

String PRIMARY_ABI_RUN

Constant Value: "primary-abi-only"

SKIP_HOST_ARCH_CHECK

String SKIP_HOST_ARCH_CHECK

Constant Value: "skip-host-arch-check"

Public constructors

ITestSuite

ITestSuite ()

Public methods

getAbis

Set<IAbi> getAbis (ITestDevice device)

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

Parameters
device ITestDevice

Returns
Set<IAbi> The set of ABIs to run the tests on

Throws
DeviceNotAvailableException

getBuildInfo

IBuildInfo getBuildInfo ()

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

Returns
IBuildInfo

getDevice

ITestDevice getDevice ()

Get the device under test.

Returns
ITestDevice the ITestDevice

getDirectModule

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

String getRequestedAbi ()

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

Returns
String

getRuntimeHint

long getRuntimeHint ()

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

Returns
long

loadTests

LinkedHashMap<String, IConfiguration> 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
LinkedHashMap<String, IConfiguration>

run

void run (ITestInvocationListener listener)

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

Parameters
listener ITestInvocationListener: the ITestInvocationListener of test results

Throws
DeviceNotAvailableException

setBuild

void setBuild (IBuildInfo buildInfo)

Parameters
buildInfo IBuildInfo

setCollectTestsOnly

void setCollectTestsOnly (boolean shouldCollectTest)

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

setDevice

void setDevice (ITestDevice device)

Inject the device under test.

Parameters
device ITestDevice: the ITestDevice to use

setInvocationContext

void setInvocationContext (IInvocationContext invocationContext)

Parameters
invocationContext IInvocationContext

setMetricCollectors

void setMetricCollectors (List<IMetricCollector> collectors)

Sets the list of IMetricCollectors defined for the test run.

Parameters
collectors List

setShouldMakeDynamicModule

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

void setSystemStatusChecker (List<ISystemStatusChecker> systemCheckers)

Sets the ISystemStatusCheckers from the configuration for the test.

Parameters
systemCheckers List

split

Collection<IRemoteTest> 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
Collection<IRemoteTest> a collection of subtests to be executed separately or null if test is not currently shardable

Protected methods

filterByConfigMetadata

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.

getAbisForBuildTargetArch

Set<String> getAbisForBuildTargetArch ()

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

Returns
Set<String>