IInvocationExecution

public interface IInvocationExecution

com.android.tradefed.invoker.IInvocationExecution


Interface describing the actions that will be done as part of an invocation. The invocation TestInvocation itself ensure the order of the calls.

Summary

Public methods

default void cleanUpBuilds(IInvocationContext context, IConfiguration config)

Execute the build_provider clean up step.

default void doCleanUp(IInvocationContext context, IConfiguration config, Throwable exception)

Execute the target_preparer and multi_target_preparer cleanUp step.

default void doSetup(IInvocationContext context, IConfiguration config, ITestInvocationListener listener)

Execute the target_preparer and multi_target_preparer setUp step.

default void doTeardown(IInvocationContext context, IConfiguration config, ITestLogger logger, Throwable exception)

Execute the target_preparer and multi_target_preparer teardown step.

default boolean fetchBuild(IInvocationContext context, IConfiguration config, IRescheduler rescheduler, ITestInvocationListener listener)

Execute the build_provider step of the invocation.

abstract void reportLogs(ITestDevice device, ITestInvocationListener listener, TestInvocation.Stage stage)

Report some device logs at different stage of the invocation.

abstract boolean resetBuildAndReschedule(Throwable exception, ITestInvocationListener listener, IConfiguration config, IInvocationContext context)

Report a failure for the invocation.

default void runDevicePostInvocationTearDown(IInvocationContext context, IConfiguration config)

Invoke the ITestDevice#postInvocationTearDown() for each device part of the invocation.

default void runDevicePreInvocationSetup(IInvocationContext context, IConfiguration config, ITestLogger logger)

Invoke the ITestDevice#preInvocationSetup(IBuildInfo) for each device part of the invocation.

default void runTests(IInvocationContext context, IConfiguration config, ITestInvocationListener listener)

Runs the test.

default boolean shardConfig(IConfiguration config, IInvocationContext context, IRescheduler rescheduler)

Attempt to shard the configuration into sub-configurations, to be re-scheduled to run on multiple resources in parallel.

Public methods

cleanUpBuilds

public void cleanUpBuilds (IInvocationContext context, 
                IConfiguration config)

Execute the build_provider clean up step. Associated with the build fetching.

Parameters
context IInvocationContext: the IInvocationContext of the invocation.

config IConfiguration: the IConfiguration of this test run.

doCleanUp

public void doCleanUp (IInvocationContext context, 
                IConfiguration config, 
                Throwable exception)

Execute the target_preparer and multi_target_preparer cleanUp step. Does the devices clean up.

Parameters
context IInvocationContext: the IInvocationContext of the invocation.

config IConfiguration: the IConfiguration of this test run.

exception Throwable: the original exception thrown by the test running.

doSetup

public void doSetup (IInvocationContext context, 
                IConfiguration config, 
                ITestInvocationListener listener)

Execute the target_preparer and multi_target_preparer setUp step. Does all the devices setup required for the test to run.

Parameters
context IInvocationContext: the IInvocationContext of the invocation.

config IConfiguration: the IConfiguration of this test run.

listener ITestInvocationListener: the ITestInvocation to report setup failures.

Throws
com.android.tradefed.targetprep.TargetSetupError
com.android.tradefed.targetprep.BuildError
DeviceNotAvailableException
BuildError
TargetSetupError

doTeardown

public void doTeardown (IInvocationContext context, 
                IConfiguration config, 
                ITestLogger logger, 
                Throwable exception)

Execute the target_preparer and multi_target_preparer teardown step. Does the devices tear down associated with the setup.

Parameters
context IInvocationContext: the IInvocationContext of the invocation.

config IConfiguration: the IConfiguration of this test run.

logger ITestLogger: the ITestLogger to report logs.

exception Throwable: the original exception thrown by the test running.

Throws
Throwable

fetchBuild

public boolean fetchBuild (IInvocationContext context, 
                IConfiguration config, 
                IRescheduler rescheduler, 
                ITestInvocationListener listener)

Execute the build_provider step of the invocation.

Parameters
context IInvocationContext: the IInvocationContext of the invocation.

config IConfiguration: the IConfiguration of this test run.

rescheduler IRescheduler: the IRescheduler, for rescheduling portions of the invocation for execution on another resource(s)

listener ITestInvocationListener: the ITestInvocation to report build download failures.

Returns
boolean True if we successfully downloaded the build, false otherwise.

Throws
com.android.tradefed.build.BuildRetrievalError
DeviceNotAvailableException
BuildRetrievalError

reportLogs

public abstract void reportLogs (ITestDevice device, 
                ITestInvocationListener listener, 
                TestInvocation.Stage stage)

Report some device logs at different stage of the invocation. For example: logcat.

Parameters
device ITestDevice: The device to report logs from.

listener ITestInvocationListener: The logger for the logs.

stage TestInvocation.Stage: The stage of the invocation we are at.

resetBuildAndReschedule

public abstract boolean resetBuildAndReschedule (Throwable exception, 
                ITestInvocationListener listener, 
                IConfiguration config, 
                IInvocationContext context)

Report a failure for the invocation.

Parameters
exception Throwable: The exception that should be reported.

listener ITestInvocationListener: The invocation listener.

config IConfiguration: The configuration currently running.

context IInvocationContext: The IInvocationContext of the invocation.

Returns
boolean True if the configuration should be rescheduled, False otherwise.

runDevicePostInvocationTearDown

public void runDevicePostInvocationTearDown (IInvocationContext context, 
                IConfiguration config)

Invoke the ITestDevice#postInvocationTearDown() for each device part of the invocation.

Parameters
context IInvocationContext: the IInvocationContext of the invocation.

config IConfiguration: the IConfiguration of this test run.

runDevicePreInvocationSetup

public void runDevicePreInvocationSetup (IInvocationContext context, 
                IConfiguration config, 
                ITestLogger logger)

Invoke the ITestDevice#preInvocationSetup(IBuildInfo) for each device part of the invocation.

Parameters
context IInvocationContext: the IInvocationContext of the invocation.

config IConfiguration: the IConfiguration of this test run.

logger ITestLogger: the ITestLogger to report logs.

Throws
com.android.tradefed.device.DeviceNotAvailableException
TargetSetupError
DeviceNotAvailableException

runTests

public void runTests (IInvocationContext context, 
                IConfiguration config, 
                ITestInvocationListener listener)

Runs the test.

Parameters
context IInvocationContext: the IInvocationContext to run tests on

config IConfiguration: the IConfiguration to run

listener ITestInvocationListener: the ITestInvocationListener of test results

Throws
Throwable

shardConfig

public boolean shardConfig (IConfiguration config, 
                IInvocationContext context, 
                IRescheduler rescheduler)

Attempt to shard the configuration into sub-configurations, to be re-scheduled to run on multiple resources in parallel.

If a shard count is greater than 1, it will simply create configs for each shard by setting shard indices and reschedule them. If a shard count is not set,it would fallback to IShardHelper#shardConfig.

Parameters
config IConfiguration: the current IConfiguration.

context IInvocationContext: the IInvocationContext holding the info of the tests.

rescheduler IRescheduler: the IRescheduler

Returns
boolean true if test was sharded. Otherwise return false