G測試

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)

從臨時腳本運行 gtest 命令的輔助方法,以防命令太長而無法由 adb 直接運行。

String getGTestCmdLine (String fullPath, String flags)

構建要運行的 gtest 命令的幫助程序方法。

String loadFilter (String binaryOnDevice)

定義獲取過濾器方法。

boolean shouldRunFile (String fullPath)

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

公共構造函數

G測試

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

setNativeTestDevicePath

public void setNativeTestDevicePath (String path)

參數
path String

受保護的方法

創建標誌文件

protected String createFlagFile (String filter)

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

參數
filter String : 過濾字符串

退貨
String包含過濾器的文件的路徑。

投擲
DeviceNotAvailableException

executeCommandByScript

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

從臨時腳本運行 gtest 命令的輔助方法,以防命令太長而無法由 adb 直接運行。

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

cmd String : 要運行的命令字符串

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

投擲
DeviceNotAvailableException

getGTestCmdLine

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如果我們應該執行所述文件,則為真。