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 | ISOLATION_COST
 | 
| 
    public
    static
    final
    String | MODULE_ABI
 | 
| 
    public
    static
    final
    String | MODULE_CACHEDThis property is set to true if the test module results were cached. | 
| 
    public
    static
    final
    String | MODULE_CONTROLLER
 | 
| 
    public
    static
    final
    String | MODULE_EXTERNAL_DEPENDENCIES
 | 
| 
    public
    static
    final
    String | MODULE_IDModule ID the name that will be used to identify uniquely the module during testRunStart. | 
| 
    public
    static
    final
    String | MODULE_INVOCATION_ATTRIBUTE_FLAG_OVERRIDES_KEY
 | 
| 
    public
    static
    final
    String | MODULE_ISOLATEDThis property is set to true if the module was running on a freshly prepared device. | 
| 
    public
    static
    final
    String | MODULE_NAMEModule 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 | MODULE_PARAMETERIZATION
 | 
| 
    public
    static
    final
    String | MODULE_SKIPPEDThis property is set to true if the test module was skipped | 
| 
    public
    static
    final
    String | MODULE_TEST_COUNT
 | 
| 
    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 | SPARSE_MODULEThis property is set to true if only module level events are reported. | 
| 
    public
    static
    final
    String | TEAR_DOWN_TIME
 | 
| 
    public
    static
    final
    String | TEST_TIME
 | 
| Public constructors | |
|---|---|
| 
      ModuleDefinition()
       | |
| 
      ModuleDefinition(String name, Constructor | |
| 
      ModuleDefinition(String name, Constructor | |
| Public methods | |
|---|---|
| 
        
        
        
        
        
        int | 
      compareTo(ModuleDefinition moduleDef)
      
 | 
| 
        
        
        
        
        
        String | 
      getId()
      Return the unique module name. | 
| 
        
        
        
        
        
        Integer | 
      getIntraModuleShardCount()
       | 
| 
        
        
        
        
        
        Integer | 
      getIntraModuleShardIndex()
       | 
| 
        
        
        
        
        
        IConfiguration | 
      getModuleConfiguration()
       | 
| 
        
        
        
        
        
        IInvocationContext | 
      getModuleInvocationContext()
      Returns the  | 
| 
        
        
        
        
        
         | 
      getRequiredTokens(TestInformation testInfo)
       | 
| 
        
        
        
        
        
        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 | 
      neededDevices()
      Returns the number of devices expected to run this test. | 
| 
        
        
        
        
        
        int | 
      numTests()
      Returns the current number of  | 
| 
        
        
        
        final
        
        void | 
      reportNotExecuted(ITestInvocationListener listener, String message)
      Report completely not executed modules. | 
| 
        
        
        
        final
        
        void | 
      run(TestInformation moduleInfo, ITestInvocationListener listener, int maxRunLimit)
      Run all the  | 
| 
        
        
        
        final
        
        void | 
      run(TestInformation moduleInfo, ITestInvocationListener listener)
      Run all the  | 
| 
        
        
        
        
        
        Throwable | 
      runPreparation(boolean includeSuitePreparers)
      Run preparers of the test, including suite level preparers if specified. | 
| 
        
        
        
        
        
        void | 
      setBuild(IBuildInfo build)
      Inject the  | 
| 
        
        
        
        
        
        void | 
      setCollectTestsOnly(boolean collectTestsOnly)
      Enables or disables test collection mode | 
| 
        
        
        
        
        
        void | 
      setDevice(ITestDevice device)
      Inject the  | 
| 
        
        
        
        
        
        void | 
      setEnableDynamicDownload(boolean enableDynamicDownload)
      Whether or not to enable dynamic download at module level. | 
| 
        
        
        
        
        
        void | 
      setIntraModuleInformation(int shardCount, int shardIndex)
       | 
| 
        
        
        
        
        
        void | 
      setLogSaver(ILogSaver logSaver)
      Pass the invocation log saver to the module so it can use it if necessary. | 
| 
        
        
        
        final
        
        void | 
      setMergeAttemps(boolean mergeAttempts)
      Sets whether or not we should merge results. | 
| 
        
        
        
        
        
        void | 
      setMetricCollectors(Inject the List of  | 
| 
        
        
        
        
        
        void | 
      setRecoverVirtualDevice(boolean recoverVirtualDevice)
      Sets should recover virtual device. | 
| 
        
        
        
        
        
        void | 
      setReportModuleEnd(boolean shouldReportModuleEnd)
       | 
| 
        
        
        
        
        
        void | 
      setReportModuleStart(boolean shouldReportModuleStart)
       | 
| 
        
        
        
        final
        
        void | 
      setRetryDecision(IRetryDecision decision)
      Sets the  | 
| 
        
        
        
        
        
        void | 
      setUseModuleResultsForwarder(boolean useModuleResultsForwarder)
       | 
| 
        
        
        
        
        
        boolean | 
      shouldRecoverVirtualDevice()
      Returns if we should recover virtual device. | 
| 
        
        
        
        
        
        String | 
      toString()
      
 | 
| 
        
        
        
        
        
        void | 
      transferSuiteLevelOptions(IConfiguration mSuiteConfiguration)
      Copy a few of the suite level configuration | 
| Protected methods | |
|---|---|
| 
        
        
        
        
        
        boolean | 
      hasTests()
      Return True if the Module still has  | 
Fields
ISOLATION_COST
public static final String ISOLATION_COST
MODULE_ABI
public static final String MODULE_ABI
MODULE_CACHED
public static final String MODULE_CACHED
This property is set to true if the test module results were cached.
MODULE_CONTROLLER
public static final String MODULE_CONTROLLER
MODULE_EXTERNAL_DEPENDENCIES
public static final String MODULE_EXTERNAL_DEPENDENCIES
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_INVOCATION_ATTRIBUTE_FLAG_OVERRIDES_KEY
public static final String MODULE_INVOCATION_ATTRIBUTE_FLAG_OVERRIDES_KEY
MODULE_ISOLATED
public static final String MODULE_ISOLATED
This property is set to true if the module was running on a freshly prepared device.
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.
MODULE_PARAMETERIZATION
public static final String MODULE_PARAMETERIZATION
MODULE_SKIPPED
public static final String MODULE_SKIPPED
This property is set to true if the test module was skipped
MODULE_TEST_COUNT
public static final String MODULE_TEST_COUNT
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
SPARSE_MODULE
public static final String SPARSE_MODULE
This property is set to true if only module level events are reported.
TEAR_DOWN_TIME
public static final String TEAR_DOWN_TIME
TEST_TIME
public static final String TEST_TIME
Public constructors
ModuleDefinition
public ModuleDefinition ()
ModuleDefinition
public ModuleDefinition (String name, 
                 tests, 
                 preparersPerDevice, 
                 multiPreparers, 
                IConfiguration moduleConfig)   Constructor
| Parameters | |
|---|---|
| name | String: unique name of the test configuration. | 
| tests | : list ofIRemoteTestthat needs to run. | 
| preparersPerDevice | : list ofITargetPreparerto be used to setup the device. | 
| multiPreparers |  | 
| moduleConfig | IConfiguration: theIConfigurationof the underlying module config. | 
ModuleDefinition
public ModuleDefinition (String name, 
                 tests, 
                 preparersPerDevice, 
                 suitePreparersPerDevice, 
                 multiPreparers, 
                IConfiguration moduleConfig)    Constructor
| Parameters | |
|---|---|
| name | String: unique name of the test configuration. | 
| tests | : list ofIRemoteTestthat needs to run. | 
| preparersPerDevice | : list ofITargetPreparerto be used to setup the device. | 
| suitePreparersPerDevice |  | 
| multiPreparers |  | 
| moduleConfig | IConfiguration: theIConfigurationof 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 | |
getIntraModuleShardCount
public Integer getIntraModuleShardCount ()
| Returns | |
|---|---|
| Integer | |
getIntraModuleShardIndex
public Integer getIntraModuleShardIndex ()
| Returns | |
|---|---|
| Integer | |
getModuleInvocationContext
public IInvocationContext getModuleInvocationContext ()
Returns the IInvocationContext associated with the module.
| Returns | |
|---|---|
| IInvocationContext | |
getRequiredTokens
publicgetRequiredTokens (TestInformation testInfo) 
| Parameters | |
|---|---|
| testInfo | TestInformation | 
| 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 | |
neededDevices
public int neededDevices ()
Returns the number of devices expected to run this test.
| Returns | |
|---|---|
| int | |
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 (TestInformation moduleInfo, ITestInvocationListener listener, 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 | |
|---|---|
| moduleInfo | TestInformation: theTestInformationfor the module. | 
| listener | ITestInvocationListener: theITestInvocationListenerwhere to report results. | 
| maxRunLimit | int: the max number of runs for each testcase. | 
| Throws | |
|---|---|
| DeviceNotAvailableException | in case of device going offline. | 
run
public final void run (TestInformation moduleInfo, 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 | |
|---|---|
| moduleInfo | TestInformation | 
| listener | ITestInvocationListener: theITestInvocationListenerwhere to report results. | 
| Throws | |
|---|---|
| DeviceNotAvailableException | in case of device going offline. | 
runPreparation
public Throwable runPreparation (boolean includeSuitePreparers)
Run preparers of the test, including suite level preparers if specified.
| Parameters | |
|---|---|
| includeSuitePreparers | boolean: Set totrueto also run suite level preparers. | 
| Returns | |
|---|---|
| Throwable | Throwableof any exception raised when running preparers. | 
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 | 
setEnableDynamicDownload
public void setEnableDynamicDownload (boolean enableDynamicDownload)
Whether or not to enable dynamic download at module level.
| Parameters | |
|---|---|
| enableDynamicDownload | boolean | 
setIntraModuleInformation
public void setIntraModuleInformation (int shardCount, 
                int shardIndex)| Parameters | |
|---|---|
| shardCount | int | 
| shardIndex | int | 
setLogSaver
public void setLogSaver (ILogSaver logSaver)
Pass the invocation log saver to the module so it can use it if necessary.
| Parameters | |
|---|---|
| logSaver | ILogSaver | 
setMergeAttemps
public final void setMergeAttemps (boolean mergeAttempts)
Sets whether or not we should merge results.
| Parameters | |
|---|---|
| mergeAttempts | boolean | 
setMetricCollectors
public void setMetricCollectors (collectors) 
Inject the List of IMetricCollector to be used by the module.
| Parameters | |
|---|---|
| collectors |  | 
setRecoverVirtualDevice
public void setRecoverVirtualDevice (boolean recoverVirtualDevice)
Sets should recover virtual device.
| Parameters | |
|---|---|
| recoverVirtualDevice | boolean | 
setReportModuleEnd
public void setReportModuleEnd (boolean shouldReportModuleEnd)
| Parameters | |
|---|---|
| shouldReportModuleEnd | boolean | 
setReportModuleStart
public void setReportModuleStart (boolean shouldReportModuleStart)
| Parameters | |
|---|---|
| shouldReportModuleStart | boolean | 
setRetryDecision
public final void setRetryDecision (IRetryDecision decision)
Sets the IRetryDecision to be used for intra-module retry.
| Parameters | |
|---|---|
| decision | IRetryDecision | 
setUseModuleResultsForwarder
public void setUseModuleResultsForwarder (boolean useModuleResultsForwarder)
| Parameters | |
|---|---|
| useModuleResultsForwarder | boolean | 
shouldRecoverVirtualDevice
public boolean shouldRecoverVirtualDevice ()
Returns if we should recover virtual device.
| Returns | |
|---|---|
| boolean | |
toString
public String toString ()
| Returns | |
|---|---|
| String | |
transferSuiteLevelOptions
public void transferSuiteLevelOptions (IConfiguration mSuiteConfiguration)
Copy a few of the suite level configuration
| Parameters | |
|---|---|
| mSuiteConfiguration | IConfiguration | 
Protected methods
hasTests
protected boolean hasTests ()
Return True if the Module still has IRemoteTest to run in its pool. False otherwise.
| Returns | |
|---|---|
| boolean | |
