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 使用的过滤条件,以避免参数大小存在任何操作系统限制。 |
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 ()
公共方法
isRebootBeforeTestEnabled
public boolean isRebootBeforeTestEnabled ()
| 返回 | |
|---|---|
boolean |
|
得分
public void run (TestInformation testInfo, ITestInvocationListener listener)
| 参数 | |
|---|---|
testInfo |
TestInformation |
listener |
ITestInvocationListener |
| 抛出 | |
|---|---|
DeviceNotAvailableException |
|
setNativeTestDevicePath
public void setNativeTestDevicePath (String path)
| 参数 | |
|---|---|
path |
String |
受保护的方法
createFlagFile
protected String createFlagFile (String filter)
创建一个文件,其中包含将通过 --gtest_flagfile 使用的过滤器,以避免参数大小受到任何操作系统限制。
| 参数 | |
|---|---|
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。 |