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.Stage

 

Constants

String BATT_TAG

String BUILD_ERROR_BUGREPORT_NAME

String COMMAND_ARGS_KEY

Key of the command line args attributes

String DEVICE_LOG_NAME_PREFIX

String DEVICE_UNRESPONSIVE_BUGREPORT_NAME

String EMULATOR_LOG_NAME_PREFIX

String INVOCATION_ENDED_BUGREPORT_NAME

String TARGET_SETUP_ERROR_BUGREPORT_NAME

String TRADEFED_LOG_NAME

Public constructors

TestInvocation()

Public methods

IInvocationExecution createInvocationExec(boolean isSandboxed)

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()

Notify the TestInvocation that TradeFed has been requested to stop.

String toString()

Protected methods

void setExitCode(CommandRunner.ExitCode code, Throwable stack)

Helper to set the exit code.

Constants

BATT_TAG

static final String BATT_TAG

Constant Value: "[battery level]"

BUILD_ERROR_BUGREPORT_NAME

static final String BUILD_ERROR_BUGREPORT_NAME

Constant Value: "build_error_bugreport"

COMMAND_ARGS_KEY

public static final String COMMAND_ARGS_KEY

Key of the command line args attributes

Constant Value: "command_line_args"

DEVICE_LOG_NAME_PREFIX

static final String DEVICE_LOG_NAME_PREFIX

Constant Value: "device_logcat_"

DEVICE_UNRESPONSIVE_BUGREPORT_NAME

static final String DEVICE_UNRESPONSIVE_BUGREPORT_NAME

Constant Value: "device_unresponsive_bugreport"

EMULATOR_LOG_NAME_PREFIX

static final String EMULATOR_LOG_NAME_PREFIX

Constant Value: "emulator_log_"

INVOCATION_ENDED_BUGREPORT_NAME

static final String INVOCATION_ENDED_BUGREPORT_NAME

Constant Value: "invocation_ended_bugreport"

TARGET_SETUP_ERROR_BUGREPORT_NAME

static final String TARGET_SETUP_ERROR_BUGREPORT_NAME

Constant Value: "target_setup_error_bugreport"

TRADEFED_LOG_NAME

static final String TRADEFED_LOG_NAME

Constant Value: "host_log"

Public constructors

TestInvocation

public TestInvocation ()

Public methods

createInvocationExec

public IInvocationExecution createInvocationExec (boolean isSandboxed)

Create the invocation path that should be followed.

Parameters
isSandboxed boolean: If we are currently running in the sandbox, then a special path is applied.

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
Throwable

notifyInvocationStopped

public void notifyInvocationStopped ()

Notify the TestInvocation that TradeFed has been requested to stop.

toString

public String toString ()

Returns
String

Protected methods

setExitCode

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

Helper to set the exit code. Exposed for testing.

Parameters
code CommandRunner.ExitCode

stack Throwable