測試

public class GTest
extends GTestBase implements IDeviceTest

java.lang.Object
com.android.tradefed.testtype.GTestBase
com.android.tradefed.testtype.GTest


在給定設備上執行本機測試包的測試。

概括

公共構造函數

GTest ()

公共方法

ITestDevice getDevice ()

獲取被測設備。

boolean isRebootBeforeTestEnabled ()
void run ( TestInformation testInfo, ITestInvocationListener listener)

void setDevice ( ITestDevice device)

注入被測設備。

void setNativeTestDevicePath (String path)

受保護的方法

String createFlagFile (String filter)

建立一個包含將通過 --gtest_flagfile 使用的過濾器的文件,以避免 args 大小的任何作業系統限制。

void executeCommandByScript ( ITestDevice testDevice, String cmd, IShellOutputReceiver resultParser)

在命令太長而無法直接由 adb 執行的情況下,從臨時腳本執行 gtest 命令的幫助程式方法。

String getGTestCmdLine (String fullPath, String flags)

建立要執行的 gtest 命令的幫助程式方法。

String loadFilter (String binaryOnDevice)

定義獲取過濾器方法。

boolean shouldRunFile (String fullPath)

幫助方法來確定我們是否應該執行給定的文件。

公共構造函數

測試

public GTest ()

公共方法

取得設備

public ITestDevice getDevice ()

獲取被測設備。

退貨
ITestDevice ITestDevice

isRebootBeforeTestEnabled

public boolean isRebootBeforeTestEnabled ()

退貨
boolean

跑步

public void run (TestInformation testInfo, 
                ITestInvocationListener listener)

參數
testInfo TestInformation

listener ITestInvocationListener

投擲
DeviceNotAvailableException

設定設備

public void setDevice (ITestDevice device)

注入被測設備。

參數
device ITestDevice :要使用的ITestDevice

設定NativeTestDevicePath

public void setNativeTestDevicePath (String path)

參數
path String

受保護的方法

建立標誌文件

protected String createFlagFile (String filter)

建立一個包含將通過 --gtest_flagfile 使用的過濾器的文件,以避免 args 大小的任何作業系統限制。

參數
filter String : 過濾字串

退貨
String包含過濾器的檔案的路徑。

投擲
DeviceNotAvailableException

透過腳本執行命令

protected void executeCommandByScript (ITestDevice testDevice, 
                String cmd, 
                IShellOutputReceiver resultParser)

在命令太長而無法直接由 adb 執行的情況下,從臨時腳本執行 gtest 命令的幫助程式方法。

參數
testDevice ITestDevice :運行命令的設備

cmd String : 要執行的命令字串

resultParser IShellOutputReceiver :用於讀取測試結果的輸出接收器

投擲
DeviceNotAvailableException

取得GTestCmdLine

protected String getGTestCmdLine (String fullPath, 
                String flags)

建立要執行的 gtest 命令的幫助程式方法。

參數
fullPath String : 裝置上 gtest 二進位檔案的絕對檔案系統路徑

flags String : gtest 執行標誌

退貨
String為 gtest 運行的 shell 命令列

載入過濾器

protected String loadFilter (String binaryOnDevice)

定義獲取過濾器方法。

子類別必須實作如何取得自己的過濾器。

參數
binaryOnDevice String :過濾器檔案的完整路徑。

退貨
String過濾字串。

投擲
DeviceNotAvailableException

應該運行文件

protected boolean shouldRunFile (String fullPath)

幫助方法來確定我們是否應該執行給定的文件。

參數
fullPath String :相關文件的完整路徑

退貨
boolean true 如果我們應該執行該檔案。