public interface ITargetPreparer
implements IDisableable
Known Indirect Subclasses
AbstractTargetCleaner An ITargetCleaner class with a stub setUp(ITestDevice, IBuildInfo) method  
AdditionalFilesInstaller A ITargetPreparer that pushes all getFiles() to specific path on device. 
AllTestAppsInstallSetup A ITargetPreparer that installs all apps from a getTestsDir() folder onto device. 
AppSetup A ITargetPreparer that installs an apk and its tests. 
BaseTargetPreparer Base implementation class for ITargetPreparer that allows to control whether the object is disabled or not. 
BuildInfoAttributePreparer A ITargetPreparer that adds arbitrary attributes to the IBuildInfo
BuildInfoRecorder An ITargetPreparer that writes build info meta data into a specified file. 
CheckPairingPreparer A CompanionAwarePreparer that verifies BT bonding between primary and companion devices  
CompanionAllocator Base class that takes care of allocating and freeing companion device

getCompanionDeviceSelectionOptions() should be implemented to describe the criteria needed to allocate the companion device  

CompanionAwarePreparer An ITargetPreparer that encapsulates the logic of getting an already allocated companion device. 
CompanionRunCommandTargetPreparer A ITargetPreparer that runs specified commands on the allocated companion device  
CompanionTestAppInstallSetup A ITargetPreparer that installs one or more apps from a getTestsDir() folder onto an allocated companion device. 
ConnectionChecker Target preparer that waits until an ip address is asigned to any of the specified interfaces. 
CpuThrottlingWaiter An ITargetPreparer that waits until max frequency on all cores are restored to highest level available  
CrashCollector A ITargetPreparer that runs crash collector on device which suppresses and logs crashes during test execution. 
DeviceBuildInfoInjector A ITargetPreparer that inserts DeviceBuildDescriptor metadata into the IBuildInfo
DeviceCleaner Performs reboot or format as cleanup action after test, and optionally turns screen off  
DeviceFlashPreparer A ITargetPreparer that flashes an image on physical Android hardware. 
DeviceSetup A ITargetPreparer that configures a device for testing based on provided Options. 
DeviceStorageFiller Target preparer to fill up storage so some amount of free space is available. 
DeviceStringPusher Target preparer to write a string to a file. 
DeviceWiper A ITargetPreparer that wipes userdata  
EraseUserDataPreparer A ITargetPreparer that wipes user data on the device. 
FileCleaner A ITargetCleaner that removes filesystem files on teardown  
FolderSaver A ITargetCleaner that pulls directories off device, compresses and saves it into logging backend. 
ITargetCleaner Cleans up the target device after the test run has finished. 
InstallAllTestZipAppsSetup A ITargetPreparer that installs all apps in a test zip. 
InstallApkSetup A ITargetPreparer that installs one or more apks located on the filesystem. 
InstallBuildEnvApkSetup A ITargetPreparer that installs one or more test apks from an Android platform build env. 
InstrumentationPreparer A ITargetPreparer that runs instrumentation  
KernelFlashPreparer A ITargetPreparer that flashes a kernel on the device. 
KeyValueConfigPreparer A ITargetPreparer which creates and pushes a simple key/value config file to the device. 
LocalSdkAvdPreparer A ITargetPreparer that will create an avd and launch an emulator  
NativeLeakCollector A ITargetCleaner that runs 'dumpsys meminfo --unreachable -a' to identify the unreachable native memory currently held by each process. 
PreloadedClassesPreparer A ITargetPreparer that replaces the preloaded classes file on a device. 
PushFileInvoker A ITargetPreparer that pushes files from tests zip onto device, mark them as executable and invokes the binary or script on device. 
PushFilePreparer A ITargetPreparer that attempts to push any number of files from any host path to any device path. 
PythonVirtualenvPreparer Sets up a Python virtualenv on the host and installs packages. 
RebootTargetPreparer Target preparer that reboots the device. 
RemoveSystemAppPreparer A ITargetPreparer for removing an apk from the system partition before a test run. 
RestartSystemServerTargetPreparer Target preparer that restarts the system server without rebooting the device. 
RootTargetPreparer Target preparer that performs "adb root". 
RunHostCommandTargetPreparer Target preparer to run arbitrary host commands before and after running the test. 
SdkAvdPreparer A ITargetPreparer that will create an avd and launch an emulator  
StopServicesSetup A ITargetPreparer that stops services on the device. 
StubTargetPreparer Placeholder empty implementation of a ITargetPreparer
SuiteApkInstaller Installs specified APKs for Suite configuration: either from $ANDROID_TARGET_OUT_TESTCASES variable or the ROOT_DIR in build info. 
TearDownPassThroughPreparer Allows for running tearDown on preparers that are included in a config as an object. 
TemperatureThrottlingWaiter An ITargetPreparer that waits until device's temperature gets down to target  
TestAppInstallSetup A ITargetPreparer that installs one or more apps from a getTestsDir() folder onto device. 
TestFilePushSetup A ITargetPreparer that pushes one or more files/dirs from a getTestsDir() folder onto device. 
TestSystemAppInstallSetup A ITargetPreparer that installs one or more apps from a getTestsDir() folder onto the /system partition on device. 
TimeSetterTargetPreparer Target preparer to restore the correct time to the device on cleanup. 
TimeWaster A simple target preparer to waste time and potentially restart the device. 
WaitForDeviceDatetimePreparer A ITargetPreparer that waits for datetime to be set on device

Optionally this preparer can force a TargetSetupError if datetime is not set within timeout, or force host datetime onto device,  

WifiPreparer A ITargetPreparer that configures wifi on the device if necessary. 

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.


Public methods

abstract void setUp(ITestDevice device, IBuildInfo buildInfo)

Perform the target setup for testing.

Public methods


void setUp (ITestDevice device, 
                IBuildInfo buildInfo)

Perform the target setup for testing.

device ITestDevice: the ITestDevice to prepare.

buildInfo IBuildInfo: data about the build under test.

TargetSetupError if fatal error occurred setting up environment
DeviceNotAvailableException if device became unresponsive