测试

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 如果我们应该执行该文件。