GTest

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 使用的篩選器,以避免 OS 對 args 大小的限制。

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

輔助方法,用於從暫時性指令碼執行 gtest 指令,如果指令太長,無法直接由 ADB 執行。

String getGTestCmdLine(String fullPath, String flags)

輔助方法,用於建構要執行的 gtest 指令。

String loadFilter(String binaryOnDevice)

定義 get 篩選器方法。

boolean shouldRunFile(String fullPath)

輔助方法,用於判斷是否應執行特定檔案。

公用建構函式

GTest

public GTest ()

公用方法

getDevice

public ITestDevice getDevice ()

取得測試裝置。

傳回
ITestDevice ITestDevice

isRebootBeforeTestEnabled

public boolean isRebootBeforeTestEnabled ()

傳回
boolean

得分

public void run (TestInformation testInfo, 
                ITestInvocationListener listener)

參數
testInfo TestInformation

listener ITestInvocationListener

擲回
DeviceNotAvailableException

setDevice

public void setDevice (ITestDevice device)

插入測試中的裝置。

參數
device ITestDevice:要使用的 ITestDevice

setNativeTestDevicePath

public void setNativeTestDevicePath (String path)

參數
path String

受保護的方法

createFlagFile

protected String createFlagFile (String filter)

建立檔案,其中包含將透過 --gtest_flagfile 使用的篩選器,以避免 OS 限制引數大小。

參數
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 指令列

loadFilter

protected String loadFilter (String binaryOnDevice)

定義 get 篩選器方法。

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

參數
binaryOnDevice String:篩選器檔案的完整路徑。

傳回
String 篩選字串。

擲回
DeviceNotAvailableException

shouldRunFile

protected boolean shouldRunFile (String fullPath)

輔助方法,用於判斷是否應執行特定檔案。

參數
fullPath String:問題檔案的完整路徑

傳回
boolean 如果我們應執行該檔案,則為 true。