XCode TestPlan:从命令行指定要使用的配置

XCode TestPlan: specify which configuration to use from command line

我在我的XCode项目的测试计划中有一些配置,默认情况下,执行UI测试将执行所有配置,但对于某些需求我需要根据某些排除一两个CI 上的条件,我发现我可以指定要执行的方案或测试计划,但是有没有办法从命令行指定要包含或排除的测试计划配置?谢谢!

你可以这样传递配置:

$> xcodebuild test -workspace <path> 
                   -scheme <name> 
                   -destination <specifier>
                   -testPlan <name>
                   -only-test-configuration <configuration1> 
                   -only-test-configuration <configuration2>
                   ...

或者像这样跳过配置:

$> xcodebuild test -workspace <path> 
                   -scheme <name> 
                   -destination <specifier>
                   -testPlan <name>
                   -skip-test-configuration <configuration1> 
                   -skip-test-configuration <configuration2>
                   ...

帮助页面中的相关行:

$> xcodebuild -help
Usage: xcodebuild ...
Options:
    -workspace NAME                    build the workspace NAME
    -scheme NAME                       build the scheme NAME
    -destination DESTINATIONSPECIFIER  use the destination described by DESTINATIONSPECIFIER (a comma-separated set of key=value pairs describing the destination to use)
    -testPlan                          specifies the name of the test plan associated with the scheme to use for testing
    -only-test-configuration           constrains testing by specifying test configurations to include, and excluding other test configurations
    -skip-test-configuration           constrains testing by specifying test configurations to exclude, but including other test configurations
    ...