DeviceTestRunOptions

public class DeviceTestRunOptions
extends Object

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


BaseHostJUnit4Test を介してデバイス テストを実行するためのオプションのビルダークラス。

概要

パブリック コンストラクタ

DeviceTestRunOptions(String packageName)

パブリック メソッド

DeviceTestRunOptions addExtraListener(ITestLifeCycleReceiver listener)

実行中のインストルメンテーションにリスナーを追加します。

DeviceTestRunOptions addInstrumentationArg(String key, String value)

計測に渡される引数を追加します。

void clearExtraListeners()
void clearInstrumentationArgs()

以前に addInstrumentationArg(String,String) で設定されたすべての計測引数をクリアします。

String getApkFileName()

apk インストールの apk ファイルの名前を返します。

ITestDevice getDevice()
List<ITestLifeCycleReceiver> getExtraListeners()
String[] getInstallArgs()

インストール コマンドの追加オプションを返します。

Map<String, String> getInstrumentationArgs()
Long getMaxInstrumentationTimeoutMs()
Long getMaxTimeToOutputMs()
String getPackageName()
String getRunner()
String getTestClassName()
String getTestMethodName()
Long getTestTimeoutMs()
Integer getUserId()
boolean isForceQueryable()

インストールされる APK をクエリ可能にするかどうか。

boolean isGrantPermission()

apk のインストール権限を付与するかどうか。

boolean isHiddenApiCheckDisabled()
boolean isInstrumentInPcc()

ホスト側から使用される「am instrument」に --instrument-in-pcc を追加するかどうか。

boolean isIsolatedStorageDisabled()
boolean isRestartDisabled()
boolean isTestApiCheckDisabled()
boolean isWindowAnimationDisabled()
DeviceTestRunOptions setApkFileName(String apkFileName)

APK インストールの APK ファイル名を設定します。

DeviceTestRunOptions setCheckResults(boolean checkResults)

インストルメンテーション実行の結果をチェックして、失敗が発生していないことを確認するかどうかを設定します。

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

ホスト側から使用される「am instrument」に --no-hidden-api-checks を追加するかどうかを設定します。

DeviceTestRunOptions setDisableIsolatedStorage(boolean disableIsolatedStorage)

ホスト側から使用される「am instrument」に --no-isolated-storage を追加するかどうかを設定します。

DeviceTestRunOptions setDisableRestart(boolean disableRestart)

ホスト側から使用される「am instrument」に --no-restart を追加するかどうかを設定します。

DeviceTestRunOptions setDisableTestApiCheck(boolean disableTestApiCheck)

ホスト側から使用される「am instrument」に --no-test-api-access を追加するかどうかを設定します。

DeviceTestRunOptions setDisableWindowAnimation(boolean disableWindowAnimation)

ホスト側から使用される「am instrument」に --no-window-animation を追加するかどうかを設定します。

DeviceTestRunOptions setForceQueryable(boolean forceQueryable)

インストールする apk をクエリできないようにする場合は、false を設定します。

DeviceTestRunOptions setGrantPermission(boolean grantPermission)

apk のインストール権限を付与します。

DeviceTestRunOptions setInstallArgs(String... installArgs)

install コマンドの追加オプションを設定します。

DeviceTestRunOptions setInstrumentInPcc(boolean instrumentInPcc)

ホスト側から使用される「am instrument」に --instrument-in-pcc を追加するかどうかを設定します。

DeviceTestRunOptions setMaxInstrumentationTimeoutMs(Long maxInstrumentationTimeoutMs)

完全なインストルメンテーションが実行され、完了するまでの最大時間(ミリ秒単位)を設定します。

DeviceTestRunOptions setMaxTimeToOutputMs(Long maxTimeToOutputMs)

計測が停止する前に出力を停止できる最大時間(ミリ秒単位)を設定します。

DeviceTestRunOptions setRunner(String runner)

インストルメンテーションの実行に使用するインストルメンテーション ランナーを設定します。

DeviceTestRunOptions setTestClassName(String testClassName)

インストルメンテーションが実行するクラス名を設定します。

DeviceTestRunOptions setTestMethodName(String testMethodName)

インストルメンテーションが実行するメソッド名を設定します。

DeviceTestRunOptions setTestTimeoutMs(Long testTimeoutMs)

テストが中断される前に実行できる最大時間(ミリ秒)を設定します。

DeviceTestRunOptions setUserId(Integer userId)

インストルメンテーションを実行するユーザー ID を設定します。

boolean shouldCheckResults()

パブリック コンストラクタ

DeviceTestRunOptions

public DeviceTestRunOptions (String packageName)

パラメータ
packageName String

パブリック メソッド

addExtraListener

public DeviceTestRunOptions addExtraListener (ITestLifeCycleReceiver listener)

実行中のインストルメンテーションにリスナーを追加します。

パラメータ
listener ITestLifeCycleReceiver

戻り値
DeviceTestRunOptions

addInstrumentationArg

public DeviceTestRunOptions addInstrumentationArg (String key, 
                String value)

計測に渡される引数を追加します。

パラメータ
key String

value String

戻り値
DeviceTestRunOptions

clearExtraListeners

public void clearExtraListeners ()

clearInstrumentationArgs

public void clearInstrumentationArgs ()

以前に addInstrumentationArg(String,String) で設定されたすべての計測引数をクリアします。

getApkFileName

public String getApkFileName ()

apk インストールの apk ファイルの名前を返します。

戻り値
String

getDevice

public ITestDevice getDevice ()

戻り値
ITestDevice

getExtraListeners

public List<ITestLifeCycleReceiver> getExtraListeners ()

戻り値
List<ITestLifeCycleReceiver>

getInstallArgs

public String[] getInstallArgs ()

インストール コマンドの追加オプションを返します。

戻り値
String[]

getInstrumentationArgs

public Map<String, String> getInstrumentationArgs ()

戻り値
Map<String, String>

getMaxInstrumentationTimeoutMs

public Long getMaxInstrumentationTimeoutMs ()

戻り値
Long

getMaxTimeToOutputMs

public Long getMaxTimeToOutputMs ()

戻り値
Long

getPackageName

public String getPackageName ()

戻り値
String

getRunner

public String getRunner ()

戻り値
String

getTestClassName

public String getTestClassName ()

戻り値
String

getTestMethodName

public String getTestMethodName ()

戻り値
String

getTestTimeoutMs

public Long getTestTimeoutMs ()

戻り値
Long

getUserId

public Integer getUserId ()

戻り値
Integer

isForceQueryable

public boolean isForceQueryable ()

インストールする APK をクエリ可能にするかどうか。デフォルト値は true です。

戻り値
boolean

isGrantPermission

public boolean isGrantPermission ()

APK のインストール権限を付与するかどうか。

戻り値
boolean

isHiddenApiCheckDisabled

public boolean isHiddenApiCheckDisabled ()

戻り値
boolean

isInstrumentInPcc

public boolean isInstrumentInPcc ()

ホスト側から使用される「am instrument」に --instrument-in-pcc を追加するかどうか。

戻り値
boolean

isIsolatedStorageDisabled

public boolean isIsolatedStorageDisabled ()

戻り値
boolean

isRestartDisabled

public boolean isRestartDisabled ()

戻り値
boolean

isTestApiCheckDisabled

public boolean isTestApiCheckDisabled ()

戻り値
boolean

isWindowAnimationDisabled

public boolean isWindowAnimationDisabled ()

戻り値
boolean

setApkFileName

public DeviceTestRunOptions setApkFileName (String apkFileName)

APK インストールの APK ファイルの名前を設定します。

パラメータ
apkFileName String

戻り値
DeviceTestRunOptions

setCheckResults

public DeviceTestRunOptions setCheckResults (boolean checkResults)

計測実行の結果をチェックして、失敗が発生していないことを確認するかどうかを設定します。

パラメータ
checkResults boolean

戻り値
DeviceTestRunOptions

setDevice

public DeviceTestRunOptions setDevice (ITestDevice device)

パラメータ
device ITestDevice

戻り値
DeviceTestRunOptions

setDisableHiddenApiCheck

public DeviceTestRunOptions setDisableHiddenApiCheck (boolean disableHiddenApiCheck)

ホスト側から使用される「am instrument」に --no-hidden-api-checks を追加するかどうかを設定します。

パラメータ
disableHiddenApiCheck boolean

戻り値
DeviceTestRunOptions

setDisableIsolatedStorage

public DeviceTestRunOptions setDisableIsolatedStorage (boolean disableIsolatedStorage)

ホスト側から使用される「am instrument」に --no-isolated-storage を追加するかどうかを設定します。

パラメータ
disableIsolatedStorage boolean

戻り値
DeviceTestRunOptions

setDisableRestart

public DeviceTestRunOptions setDisableRestart (boolean disableRestart)

ホスト側から使用される「am instrument」に --no-restart を追加するかどうかを設定します。

パラメータ
disableRestart boolean

戻り値
DeviceTestRunOptions

setDisableTestApiCheck

public DeviceTestRunOptions setDisableTestApiCheck (boolean disableTestApiCheck)

ホスト側から使用される「am instrument」に --no-test-api-access を追加するかどうかを設定します。

パラメータ
disableTestApiCheck boolean

戻り値
DeviceTestRunOptions

setDisableWindowAnimation

public DeviceTestRunOptions setDisableWindowAnimation (boolean disableWindowAnimation)

ホスト側から使用される「am instrument」に --no-window-animation を追加するかどうかを設定します。

パラメータ
disableWindowAnimation boolean

戻り値
DeviceTestRunOptions

setForceQueryable

public DeviceTestRunOptions setForceQueryable (boolean forceQueryable)

インストールする APK をクエリ可能にしない場合は、false を設定します。

パラメータ
forceQueryable boolean

戻り値
DeviceTestRunOptions

setGrantPermission

public DeviceTestRunOptions setGrantPermission (boolean grantPermission)

apk のインストール権限を付与します。

パラメータ
grantPermission boolean

戻り値
DeviceTestRunOptions

setInstallArgs

public DeviceTestRunOptions setInstallArgs (String... installArgs)

インストール コマンドの追加オプションを設定します。

パラメータ
installArgs String

戻り値
DeviceTestRunOptions

setInstrumentInPcc

public DeviceTestRunOptions setInstrumentInPcc (boolean instrumentInPcc)

ホスト側から使用される「am instrument」に --instrument-in-pcc を追加するかどうかを設定します。

パラメータ
instrumentInPcc boolean

戻り値
DeviceTestRunOptions

setMaxInstrumentationTimeoutMs

public DeviceTestRunOptions setMaxInstrumentationTimeoutMs (Long maxInstrumentationTimeoutMs)

完全なインストルメンテーションが実行されて完了するまでの最大時間(ミリ秒)を設定します。タイムアウトなしの場合は 0 に設定します。省略可。

パラメータ
maxInstrumentationTimeoutMs Long

戻り値
DeviceTestRunOptions

setMaxTimeToOutputMs

public DeviceTestRunOptions setMaxTimeToOutputMs (Long maxTimeToOutputMs)

計測が停止される前に出力を停止できる最大時間(ミリ秒単位)を設定します。タイムアウトなしの場合は 0 に設定します。省略可。

パラメータ
maxTimeToOutputMs Long

戻り値
DeviceTestRunOptions

setRunner

public DeviceTestRunOptions setRunner (String runner)

インストルメンテーションの実行に使用するインストルメンテーション ランナーを設定します。デフォルトのランナーは「android.support.test.runner.AndroidJUnitRunner」です。省略可。

パラメータ
runner String

戻り値
DeviceTestRunOptions

setTestClassName

public DeviceTestRunOptions setTestClassName (String testClassName)

インストルメンテーションを実行するクラス名を設定します。計測は、クラスのみを実行するようにフィルタリングされます。setTestMethodName(String) とともに使用できます。省略可。

パラメータ
testClassName String

戻り値
DeviceTestRunOptions

setTestMethodName

public DeviceTestRunOptions setTestMethodName (String testMethodName)

インストルメンテーションが実行するメソッド名を設定します。正しく動作させるには setTestClassName(String) を設定する必要があります。省略可。

パラメータ
testMethodName String

戻り値
DeviceTestRunOptions

setTestTimeoutMs

public DeviceTestRunOptions setTestTimeoutMs (Long testTimeoutMs)

テストが中断される前に実行できる最大時間(ミリ秒)を設定します。タイムアウトなしの場合は 0 に設定します。省略可。

パラメータ
testTimeoutMs Long

戻り値
DeviceTestRunOptions

setUserId

public DeviceTestRunOptions setUserId (Integer userId)

インストルメンテーションを実行するユーザー ID を設定します。省略可。

パラメータ
userId Integer

戻り値
DeviceTestRunOptions

shouldCheckResults

public boolean shouldCheckResults ()

戻り値
boolean