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

ITargetPreparer

public interface ITargetPreparer
implements IDisableable

com.android.tradefed.targetprep.ITargetPreparer


Prepares the test environment for the test run.

For example, installs software, tweaks env settings for testing, launches targets etc.

Note that multiple ITargetPreparers can be specified in a configuration. It is recommended that each ITargetPreparer clearly document its expected environment pre-setup and post-setUp. e.g. a ITargetPreparer that configures a device for testing must be run after the ITargetPreparer that installs software.

Summary

Public methods

default void setUp(ITestDevice device, IBuildInfo buildInfo)

This method is deprecated. Use setUp(com.android.tradefed.invoker.TestInformation) instead

default void setUp(TestInformation testInformation)

Perform the target setup for testing.

default void tearDown(TestInformation testInformation, Throwable e)

Perform the target cleanup/teardown after testing.

default void tearDown(ITestDevice device, IBuildInfo buildInfo, Throwable e)

This method is deprecated. Use tearDown(com.android.tradefed.invoker.TestInformation, Throwable) instead

Public methods

setUp

public void setUp (ITestDevice device, 
                IBuildInfo buildInfo)

This method is deprecated.
Use setUp(com.android.tradefed.invoker.TestInformation) instead

Perform the target setup for testing.

Parameters
device ITestDevice: the ITestDevice to prepare.

buildInfo IBuildInfo: data about the build under test.

Throws
TargetSetupError if fatal error occurred setting up environment
BuildError If an error related to the BuildInfo occurs
DeviceNotAvailableException if device became unresponsive

setUp

public void setUp (TestInformation testInformation)

Perform the target setup for testing.

Parameters
testInformation TestInformation: The TestInformation of the invocation.

Throws
TargetSetupError if fatal error occurred setting up environment
BuildError If an error occurs due to the build being prepared
DeviceNotAvailableException if device became unresponsive

tearDown

public void tearDown (TestInformation testInformation, 
                Throwable e)

Perform the target cleanup/teardown after testing.

Parameters
testInformation TestInformation: The TestInformation of the invocation.

e Throwable: if the invocation ended with an exception, this will be the exception that was caught at the Invocation level. Otherwise, will be null.

Throws
DeviceNotAvailableException if device became unresponsive

tearDown

public void tearDown (ITestDevice device, 
                IBuildInfo buildInfo, 
                Throwable e)

This method is deprecated.
Use tearDown(com.android.tradefed.invoker.TestInformation, Throwable) instead

Perform the target cleanup/teardown after testing.

Parameters
device ITestDevice: the ITestDevice to prepare.

buildInfo IBuildInfo: data about the build under test.

e Throwable: if the invocation ended with an exception, this will be the exception that was caught at the Invocation level. Otherwise, will be null.

Throws
DeviceNotAvailableException if device became unresponsive