【问题标题】:What are the correct commands to run the CTS and VTS test plans?运行 CTS 和 VTS 测试计划的正确命令是什么?
【发布时间】:2018-09-26 14:19:35
【问题描述】:

我即将为我们的 AOSP 设置 VTS 和 CTS 测试。两个测试套件都使用 Trade Federation 测试框架。令我困惑的是如何运行不同的测试计划。

根据 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

这似乎工作正常,测试似乎开始了。但后来我在 CTS (https://source.android.com/compatibility/cts/run) 的手册中读到 cts 应以run cts --plan <test-plan> 执行。他们在下面给出了示例run cts --plan CTS 来运行默认的cts计划。

通过附加以下命令启动默认测试计划(包含所有测试包): run cts --plan CTS 。这将启动所需的所有 CTS 测试 为了兼容性。

对于 CTS v1(Android 6.0 及更早版本),输入 list plan 以查看存储库中的测试计划列表或 list packages 以查看列表 存储库中的测试包。 对于 CTS v2(Android 7.0 及更高版本),输入 list modules 以查看测试模块列表。

或者,使用以下命令从命令行运行您选择的 CTS 计划:cts-tradefed run cts --plan

在测试时,它似乎也能正常工作。两个想法让我想知道。首先,示例中的测试计划用大写字母表示,即“CTS”而不是“cts”。其次,运行命令在这里的工作方式似乎完全不同。对我来说,run-command 是一个内置的 tradefed 命令是有道理的,它的参数应该是测试计划的名称。 tradefed 本身也证实了这一点。

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 tests

CTS 帮助:

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 ctsrun vts 运行实际上是有意义的。这只是一个愚蠢的问题,我完全错了吗?由于这些测试对我们的兼容性很重要,我希望确保它们以正确的方式运行。

【问题讨论】:

    标签: android cts android-cts android-vts android-tradefederation


    【解决方案1】:

    要运行计划(cts 或 vts),您可以根据您的选择性需要使用不同的命令:

    要运行完整的 vts 或 cts 测试: run &lt;plan&gt; e.g. 运行 cts / 运行 vts

    要在计划中运行特定模块: run &lt;plan&gt; -m &lt;module&gt; 例如运行 cts -m CtsMyDisplayTestCases(模块名称应与您的 Android.mk 中的 LOCAL_PACAKGE_NAME 中提到的相同)

    在计划中运行包含特定模块的多个测试的特定测试类: run &lt;plan&gt; -m &lt;module&gt; -t &lt;packageName.className&gt; 例如运行 cts -m CtsMyDisplayTestCases -t android.display.cts.ScreenTests (此命令将运行测试类“ScreenTests”中存在的所有测试,包名称与 AndroidManifest.xml 中固定的相同)

    在计划中特定模块的测试类中运行特定测试用例: run &lt;plan&gt; -m &lt;module&gt; -t &lt;packageName.className#testName&gt; 例如运行 cts -m CtsMyDisplayTestCases -t android.display.cts.ScreenTests#testDisplayName (此命令将运行测试类“ScreenTests”中存在的 testDisplayName 测试用例,包名与 AndroidManifest.xml 中固定的相同)

    您还可以查看 AOSP/cts/ 目录以了解命名约定和工作的基本概念。

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 2022-09-23
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 2016-03-24
      • 1970-01-01
      • 2014-09-01
      • 2013-01-12
      相关资源
      最近更新 更多