我即将为我们的AOSP设置VTS和CTS测试。这两个测试套件都在使用测试框架。让我困惑的是如何运行不同的测试计划。
根据VTS的文档(https://source.android.com/compatibility/vts/systems),必须决定运行哪个测试计划。然后使用run命令来测试它。
例如,如果我想运行默认的VTS测试计划,我就用它运行它。
me@computer> vts-tradefed
vts-tf > run vts这将对连接的设备启动多个测试。
接下来,在启动CTS测试时,我希望调用相应的函数,或者看起来是什么。根据下面的说明,我期望使用名为" CTS“的测试计划来运行cts测试。
me@computer> cts-tradefed
cts-tf > run cts这似乎很好,测试似乎开始了。但是,我在https://source.android.com/compatibility/cts/run手册中读到,CTS将作为run cts --plan <test-plan>执行。他们给出了下面的示例run cts --plan CTS来运行默认的cts计划。
通过附加:运行cts --计划CTS启动默认测试计划(包含所有测试包)。这就启动了所有CTS测试的兼容性。 对于CTS v1 (Android6.0和更早版本),输入list plans以查看存储库中的测试计划列表或列表包以查看存储库中的测试包列表。对于CTS v2 (Android7.0及更高版本),输入列表模块以查看测试模块列表。 或者,从命令行运行您选择的CTS计划,使用: cts-tradefed run cts --plan。
在测试时,它似乎也能工作。两个人的想法让我好奇。首先,该示例中的测试计划以大写字母引用,即"cts“而不是"CTS”。其次,在这里运行命令似乎完全不同。对我来说,run-command是一个内置的叛变命令,它的参数应该是测试计划的名称,这是有意义的。这一点也得到了叛逆本身的证实。
VTS帮助:
vts-tf > help run
r(?:un)? help:
command <config> [options] Run the specified command
<config> [options] Shortcut for the above: run specified command
cmdfile <cmdfile.txt> Run the specified commandfile
commandAndExit <config> [options] Run the specified command, and run 'exit -c' immediately afterward
cmdfileAndExit <cmdfile.txt> Run the specified commandfile, and run 'exit -c' immediately afterward
----- Vendor Test Suite specific options -----
<plan> --module/-m <module> Run a test module
<plan> --module/-m <module> --test/-t <test_name> Run a specific test from the module. Test name can be <package>.<class>, <package>.<class>#<method> or <native_binary_name>
Available Options:
--serial/-s <device_id>: The device to run the test on
--abi/-a <abi> : The ABI to run the test against
--logcat-on-failure : Capture logcat when a test fails
--bugreport-on-failure : Capture a bugreport when a test fails
--screenshot-on-failure: Capture a screenshot when a test fails
--shard-count <shards>: Shards a run into the given number of independent chunks, to run on multiple devices in parallel.
----- In order to retry a previous run -----
retry --retry <session id to retry> [--retry-type <FAILED | NOT_EXECUTED>]
Without --retry-type, retry will run both FAIL and NOT_EXECUTED testsCTS帮助:
cts-tf > help run
r(?:un)? help:
command <config> [options] Run the specified command
<config> [options] Shortcut for the above: run specified command
cmdfile <cmdfile.txt> Run the specified commandfile
commandAndExit <config> [options] Run the specified command, and run 'exit -c' immediately afterward
cmdfileAndExit <cmdfile.txt> Run the specified commandfile, and run 'exit -c' immediately afterward
----- Compatibility Test Suite specific options -----
<plan> --module/-m <module> Run a test module
<plan> --module/-m <module> --test/-t <test_name> Run a specific test from the module. Test name can be <package>.<class>, <package>.<class>#<method> or <native_binary_name>
Available Options:
--serial/-s <device_id>: The device to run the test on
--abi/-a <abi> : The ABI to run the test against
--logcat-on-failure : Capture logcat when a test fails
--bugreport-on-failure : Capture a bugreport when a test fails
--screenshot-on-failure: Capture a screenshot when a test fails
--shard-count <shards>: Shards a run into the given number of independent chunks, to run on multiple devices in parallel.
----- In order to retry a previous run -----
retry --retry <session id to retry> [--retry-type <FAILED | NOT_EXECUTED>]
Without --retry-type, retry will run both FAIL and NOT_EXECUTED tests这些解释几乎是一样的。因此,使用run cts和run vts重新运行实际上是有意义的。这是个愚蠢的问题吗?我完全错了吗?由于这些测试对于我们的可兼容性很重要,所以我想要确保它们以正确的方式运行。
发布于 2018-12-05 06:15:10
要运行计划( cts或vts),可以根据选择的需要使用不同的命令:
运行完整的vts或cts测试: run <plan>,例如运行cts /运行vts
在计划中运行特定模块的: run <plan> -m <module>,例如运行cts -m CtsMyDisplayTestCases (模块名称应与在Android.mk中的LOCAL_PACAKGE_NAME中提到的相同)
运行包含计划中特定模块的多个测试的特定测试类: run <plan> -m <module> -t <packageName.className>,例如运行cts -m CtsMyDisplayTestCases -t android.display.cts.ScreenTests (此命令将运行测试类“屏幕”中的所有测试,包名与AndroidManifest.xml中的固定名称相同)
在计划中特定模块的测试类中运行特定测试用例:例如运行cts android.display.cts.ScreenTests#testDisplayName -m CtsMyDisplayTestCases -t (此命令将运行测试类“屏幕”中的testDisplayName测试用例,包名与AndroidManifest.xml中的固定名称相同)
您还可以检查AOSP/cts/目录,以获得命名约定和工作的基本概念。
https://stackoverflow.com/questions/52519920
复制相似问题