Stay organized with collections Save and categorize content based on your preferences.

TestInformation

public class TestInformation
extends Object

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


Holder object that contains all the information and dependencies a test runner or test might need to execute properly.

Summary

Nested classes

class TestInformation.Builder

Builder to create a TestInformation instance. 

Public methods

static TestInformation createCopyTestInfo(TestInformation invocationInfo, IInvocationContext context)

Create an TestInformation with a copied ExecutionFiles.

static TestInformation createModuleTestInfo(TestInformation invocationInfo, IInvocationContext moduleContext)

Create an TestInformation representing a module rather than an invocation.

File dependenciesFolder()

Returns the folder where all the dependencies are stored for an invocation.

ExecutionFiles executionFiles()

Returns the files generated during the invocation execution.

IBuildInfo getBuildInfo()

Returns the primary device build information.

IInvocationContext getContext()

Returns the current invocation context, or the module context if this is a module.

File getDependencyFile(String fileName, boolean targetFirst)

Search for a dependency/artifact file based on its name, and whether or not it's a target or host file (for quicker search).

ITestDevice getDevice()

Returns the primary device under tests.

getDevices()

Returns the list of devices part of the invocation.

static TestInformation.Builder newBuilder()

Create a builder for creating TestInformation instances.

ExecutionProperties properties()

Returns the properties generated during the invocation execution.

final void setActiveDeviceIndex(int index)

Test Harness internal method to switch which device is returned by default with getDevice().

Public methods

createCopyTestInfo

public static TestInformation createCopyTestInfo (TestInformation invocationInfo, 
                IInvocationContext context)

Create an TestInformation with a copied ExecutionFiles.

Parameters
invocationInfo TestInformation

context IInvocationContext

Returns
TestInformation

createModuleTestInfo

public static TestInformation createModuleTestInfo (TestInformation invocationInfo, 
                IInvocationContext moduleContext)

Create an TestInformation representing a module rather than an invocation.

Parameters
invocationInfo TestInformation

moduleContext IInvocationContext

Returns
TestInformation

dependenciesFolder

public File dependenciesFolder ()

Returns the folder where all the dependencies are stored for an invocation.

Returns
File

executionFiles

public ExecutionFiles executionFiles ()

Returns the files generated during the invocation execution. Passing files through the ExecutionFiles is the recommended way to make a file available between target_preparers and tests.

Returns
ExecutionFiles

getBuildInfo

public IBuildInfo getBuildInfo ()

Returns the primary device build information.

Returns
IBuildInfo

getContext

public IInvocationContext getContext ()

Returns the current invocation context, or the module context if this is a module.

Returns
IInvocationContext

getDependencyFile

public File getDependencyFile (String fileName, 
                boolean targetFirst)

Search for a dependency/artifact file based on its name, and whether or not it's a target or host file (for quicker search).

Parameters
fileName String: The name of the file we are looking for.

targetFirst boolean: whether or not we are favoring target-side files vs. host-side files for the search.

Returns
File The found artifact file.

Throws
If the file is not found.

getDevice

public ITestDevice getDevice ()

Returns the primary device under tests.

Returns
ITestDevice

getDevices

public  getDevices ()

Returns the list of devices part of the invocation.

Returns

newBuilder

public static TestInformation.Builder newBuilder ()

Create a builder for creating TestInformation instances.

Returns
TestInformation.Builder

properties

public ExecutionProperties properties ()

Returns the properties generated during the invocation execution. Passing values and information through the ExecutionProperties is the recommended way to exchange information between target_preparers and tests.

Returns
ExecutionProperties

setActiveDeviceIndex

public final void setActiveDeviceIndex (int index)

Test Harness internal method to switch which device is returned by default with getDevice(). Always reset to 0.

Parameters
index int