Google is committed to advancing racial equity for Black communities. See how.

TestInvocation

public class TestInvocation
extends Object implements ITestInvocation

java.lang.Object
   ↳ com.android.tradefed.invoker.TestInvocation


Default implementation of ITestInvocation.

Loads major objects based on IConfiguration - retrieves build - prepares target - runs tests - reports results

Summary

Nested classes

enum TestInvocation.RunMode

The different mode an invocation can run into. 

enum TestInvocation.Stage

 

Fields

public static final String COMMAND_ARGS_KEY

Key of the command line args attributes

public static final String TRADEFED_END_HOST_LOG

public static final String TRADEFED_LOG_NAME

Public constructors

TestInvocation()

Public methods

IInvocationExecution createInvocationExec(TestInvocation.RunMode mode)

Create the invocation path that should be followed.

static String getDeviceLogName(TestInvocation.Stage stage)
static String getEmulatorLogName(TestInvocation.Stage stage)
void invoke(IInvocationContext context, IConfiguration config, IRescheduler rescheduler, ITestInvocationListener... extraListeners)

Perform the test invocation.

void notifyInvocationStopped(String message)

Notify the TestInvocation that TradeFed has been requested to stop.

static void printStageDelimiter(TestInvocation.Stage phase, boolean end)

Prints a delimiter for a given Stage of the invocation.

void registerExecutionFiles(ExecutionFiles executionFiles)
String toString()

Protected methods

void addInvocationMetric(InvocationMetricLogger.InvocationMetricKey key, String value)
void addInvocationMetric(InvocationMetricLogger.InvocationMetricKey key, long value)
void applyAutomatedReporters(IConfiguration config)
void setExitCode(CommandRunner.ExitCode code, Throwable stack)

Helper to set the exit code.

Fields

COMMAND_ARGS_KEY

public static final String COMMAND_ARGS_KEY

Key of the command line args attributes

TRADEFED_END_HOST_LOG

public static final String TRADEFED_END_HOST_LOG

TRADEFED_LOG_NAME

public static final String TRADEFED_LOG_NAME

Public constructors

TestInvocation

public TestInvocation ()

Public methods

createInvocationExec

public IInvocationExecution createInvocationExec (TestInvocation.RunMode mode)

Create the invocation path that should be followed.

Parameters
mode TestInvocation.RunMode: The mode we are currently running as.

Returns
IInvocationExecution The IInvocationExecution describing the invocation.

getDeviceLogName

public static String getDeviceLogName (TestInvocation.Stage stage)

Parameters
stage TestInvocation.Stage

Returns
String

getEmulatorLogName

public static String getEmulatorLogName (TestInvocation.Stage stage)

Parameters
stage TestInvocation.Stage

Returns
String

invoke

public void invoke (IInvocationContext context, 
                IConfiguration config, 
                IRescheduler rescheduler, 
                ITestInvocationListener... extraListeners)

Perform the test invocation.

Parameters
context IInvocationContext: the IInvocationContext to perform tests.

config IConfiguration: the IConfiguration of this test run.

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

extraListeners ITestInvocationListener: ITestInvocationListeners to notify, in addition to those in config

Throws
DeviceNotAvailableException

notifyInvocationStopped

public void notifyInvocationStopped (String message)

Notify the TestInvocation that TradeFed has been requested to stop.

Parameters
message String: The message associated with stopping the invocation

printStageDelimiter

public static void printStageDelimiter (TestInvocation.Stage phase, 
                boolean end)

Prints a delimiter for a given Stage of the invocation.

Parameters
phase TestInvocation.Stage

end boolean

registerExecutionFiles

public void registerExecutionFiles (ExecutionFiles executionFiles)

Parameters
executionFiles ExecutionFiles

toString

public String toString ()

Returns
String

Protected methods

addInvocationMetric

protected void addInvocationMetric (InvocationMetricLogger.InvocationMetricKey key, 
                String value)

Parameters
key InvocationMetricLogger.InvocationMetricKey

value String

addInvocationMetric

protected void addInvocationMetric (InvocationMetricLogger.InvocationMetricKey key, 
                long value)

Parameters
key InvocationMetricLogger.InvocationMetricKey

value long

applyAutomatedReporters

protected void applyAutomatedReporters (IConfiguration config)

Parameters
config IConfiguration

setExitCode

protected void setExitCode (CommandRunner.ExitCode code, 
                Throwable stack)

Helper to set the exit code. Exposed for testing.

Parameters
code CommandRunner.ExitCode

stack Throwable