DeviceTestRunOptions

public class DeviceTestRunOptions
extends Object

java.lang.Object
   ↳ com.android.tradefed.testtype.junit4.DeviceTestRunOptions


A builder class for options related to running device tests through BaseHostJUnit4Test.

Summary

Public constructors

DeviceTestRunOptions(String packageName)

Public methods

ITestDevice getDevice()
Long getMaxInstrumentationTimeoutMs()
Long getMaxTimeToOutputMs()
String getPackageName()
String getRunner()
String getTestClassName()
String getTestMethodName()
Long getTestTimeoutMs()
Integer getUserId()
boolean isHiddenApiCheckDisabled()
DeviceTestRunOptions setCheckResults(boolean checkResults)

Sets whether or not the results of the instrumentation run should be checked and ensure no failures occured.

DeviceTestRunOptions setDevice(ITestDevice device)
DeviceTestRunOptions setDisableHiddenApiCheck(boolean disableHiddenApiCheck)

sets whether or not to add the --no-hidden-api-checks to the 'am instrument' used from the host side.

DeviceTestRunOptions setMaxInstrumentationTimeoutMs(Long maxInstrumentationTimeoutMs)

Sets the maximum time (in milliseconds) the complete instrumentation will have to run and complete.

DeviceTestRunOptions setMaxTimeToOutputMs(Long maxTimeToOutputMs)

Sets the maximum time (in milliseconds) the instrumentation can stop outputting before being stopped.

DeviceTestRunOptions setRunner(String runner)

Sets the instrumentation runner that should be used to run the instrumentation.

DeviceTestRunOptions setTestClassName(String testClassName)

Sets the classname that the instrumentation should run.

DeviceTestRunOptions setTestMethodName(String testMethodName)

Sets the method name that the instrumentation should run.

DeviceTestRunOptions setTestTimeoutMs(Long testTimeoutMs)

Sets the maximum time (in milliseconds) a test can run before being interrupted.

DeviceTestRunOptions setUserId(Integer userId)

Sets the user id against which the instrumentation should run.

boolean shouldCheckResults()

Public constructors

DeviceTestRunOptions

public DeviceTestRunOptions (String packageName)

Parameters
packageName String

Public methods

getDevice

public ITestDevice getDevice ()

Returns
ITestDevice

getMaxInstrumentationTimeoutMs

public Long getMaxInstrumentationTimeoutMs ()

Returns
Long

getMaxTimeToOutputMs

public Long getMaxTimeToOutputMs ()

Returns
Long

getPackageName

public String getPackageName ()

Returns
String

getRunner

public String getRunner ()

Returns
String

getTestClassName

public String getTestClassName ()

Returns
String

getTestMethodName

public String getTestMethodName ()

Returns
String

getTestTimeoutMs

public Long getTestTimeoutMs ()

Returns
Long

getUserId

public Integer getUserId ()

Returns
Integer

isHiddenApiCheckDisabled

public boolean isHiddenApiCheckDisabled ()

Returns
boolean

setCheckResults

public DeviceTestRunOptions setCheckResults (boolean checkResults)

Sets whether or not the results of the instrumentation run should be checked and ensure no failures occured.

Parameters
checkResults boolean

Returns
DeviceTestRunOptions

setDevice

public DeviceTestRunOptions setDevice (ITestDevice device)

Parameters
device ITestDevice

Returns
DeviceTestRunOptions

setDisableHiddenApiCheck

public DeviceTestRunOptions setDisableHiddenApiCheck (boolean disableHiddenApiCheck)

sets whether or not to add the --no-hidden-api-checks to the 'am instrument' used from the host side.

Parameters
disableHiddenApiCheck boolean

Returns
DeviceTestRunOptions

setMaxInstrumentationTimeoutMs

public DeviceTestRunOptions setMaxInstrumentationTimeoutMs (Long maxInstrumentationTimeoutMs)

Sets the maximum time (in milliseconds) the complete instrumentation will have to run and complete. Set to 0 for no timeout. Optional.

Parameters
maxInstrumentationTimeoutMs Long

Returns
DeviceTestRunOptions

setMaxTimeToOutputMs

public DeviceTestRunOptions setMaxTimeToOutputMs (Long maxTimeToOutputMs)

Sets the maximum time (in milliseconds) the instrumentation can stop outputting before being stopped. Set to 0 for no timeout. Optional.

Parameters
maxTimeToOutputMs Long

Returns
DeviceTestRunOptions

setRunner

public DeviceTestRunOptions setRunner (String runner)

Sets the instrumentation runner that should be used to run the instrumentation. Default runner is 'android.support.test.runner.AndroidJUnitRunner'. Optional.

Parameters
runner String

Returns
DeviceTestRunOptions

setTestClassName

public DeviceTestRunOptions setTestClassName (String testClassName)

Sets the classname that the instrumentation should run. The instrumentation will be filtered to only run the class. Can be used with setTestMethodName(String). Optional.

Parameters
testClassName String

Returns
DeviceTestRunOptions

setTestMethodName

public DeviceTestRunOptions setTestMethodName (String testMethodName)

Sets the method name that the instrumentation should run. Requires setTestClassName(String) to be set in order to work properly. Optional.

Parameters
testMethodName String

Returns
DeviceTestRunOptions

setTestTimeoutMs

public DeviceTestRunOptions setTestTimeoutMs (Long testTimeoutMs)

Sets the maximum time (in milliseconds) a test can run before being interrupted. Set to 0 for no timeout. Optional.

Parameters
testTimeoutMs Long

Returns
DeviceTestRunOptions

setUserId

public DeviceTestRunOptions setUserId (Integer userId)

Sets the user id against which the instrumentation should run. Optional.

Parameters
userId Integer

Returns
DeviceTestRunOptions

shouldCheckResults

public boolean shouldCheckResults ()

Returns
boolean