TestAppInstallSetup

public class TestAppInstallSetup
extends Object implements ITargetCleaner, IAbiReceiver

java.lang.Object
   ↳ com.android.tradefed.targetprep.TestAppInstallSetup
Known Direct Subclasses
CompanionTestAppInstallSetup A ITargetPreparer that installs one or more apps from a getTestsDir() folder onto an allocated companion device. 
SuiteApkInstaller Installs specified APKs for Suite configuration: either from $ANDROID_TARGET_OUT_TESTCASES variable or the ROOT_DIR in build info. 


A ITargetPreparer that installs one or more apps from a getTestsDir() folder onto device.

This preparer will look in alternate directories if the tests zip does not exist or does not contain the required apk. The search will go in order from the last alternative dir specified to the first.

Summary

Public constructors

TestAppInstallSetup()

Public methods

void addTestFileName(String fileName)

Adds a file to the list of apks to install

IAbi getAbi()
List<String> getTestsFileName()

Returns a copy of the list of specified test apk names.

void setAbi(IAbi abi)
void setAltDir(File altDir)

Set an alternate directory.

void setUp(ITestDevice device, IBuildInfo buildInfo)

Perform the target setup for testing.

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

Perform the target cleanup/teardown after testing.

Protected methods

File getLocalPathForFilename(IBuildInfo buildInfo, String apkFileName, ITestDevice device)

Resolve the actual apk path based on testing artifact information inside build info.

String parsePackageName(File testAppFile, DeviceDescriptor deviceDescriptor)

Get the package name from the test app.

Public constructors

TestAppInstallSetup

TestAppInstallSetup ()

Public methods

addTestFileName

void addTestFileName (String fileName)

Adds a file to the list of apks to install

getAbi

IAbi getAbi ()

Returns
IAbi

getTestsFileName

List<String> getTestsFileName ()

Returns a copy of the list of specified test apk names.

Returns
List<String>

setAbi

void setAbi (IAbi abi)

Parameters
abi IAbi

setAltDir

void setAltDir (File altDir)

Set an alternate directory.

Parameters
altDir File

setUp

void setUp (ITestDevice device, 
                IBuildInfo buildInfo)

Perform the target setup for testing.

Parameters
device ITestDevice: the ITestDevice to prepare.

buildInfo IBuildInfo: data about the build under test.

Throws
TargetSetupError
DeviceNotAvailableException

tearDown

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

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

Protected methods

getLocalPathForFilename

File getLocalPathForFilename (IBuildInfo buildInfo, 
                String apkFileName, 
                ITestDevice device)

Resolve the actual apk path based on testing artifact information inside build info.

Parameters
buildInfo IBuildInfo: build artifact information

apkFileName String: filename of the apk to install

device ITestDevice: the ITestDevice being prepared

Returns
File a File representing the physical apk file on host or null if the file does not exist.

Throws
TargetSetupError

parsePackageName

String parsePackageName (File testAppFile, 
                DeviceDescriptor deviceDescriptor)

Get the package name from the test app.

Parameters
testAppFile File

deviceDescriptor DeviceDescriptor

Returns
String

Throws
TargetSetupError