如何将 xcodebuild 与 -only-testing 和 -skip-testing 标志一起使用? [英] How to use xcodebuild with -only-testing and -skip-testing flag?

查看:33
本文介绍了如何将 xcodebuild 与 -only-testing 和 -skip-testing 标志一起使用?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我注意到 xcodebuild 的手册页中有两个选项.

-only-testing:TEST-IDENTIFIER

<块引用>

通过指定要包含的测试并排除其他测试来限制测试

-skip-testing:TEST-IDENTIFIER

<块引用>

通过指定要排除的测试来限制测试,但包括其他测试

我的尝试:

xcodebuild -workspace MyWorkSpace.xcworkspace/-sdk iphone模拟器/-目的地ID=7F52F302-C6AF-4215-B269-39A6F9913D5B/-scheme SCHEME-iOS/测试-仅测试:???

TEST-IDENTIFIER 是什么意思?

解决方案

就像 Marcio 所说的,它是一个类似字符串的路径.

例如,假设您有一个名为 MyScheme 的方案,一个测试目标 MyUITests,和测试类 LoginTest,然后是测试方法 testUserLogin,只运行方法,你可以运行

xcodebuild -workspace Envoy.xcworkspace \-scheme MyScheme \-sdk iphone模拟器\-destination '平台=iOS 模拟器,名称=iPad Air 2,OS=10.1''-only-testing:MyUITests/LoginTest/testUserLogin' 测试

同样,如果你想在 LoginTest 下运行所有​​测试,你在这里运行

xcodebuild -workspace Envoy.xcworkspace \-scheme MyScheme \-sdk iphone模拟器\-destination '平台=iOS 模拟器,名称=iPad Air 2,OS=10.1''-only-testing:MyUITests/LoginTest' 测试

I've noticed that there are two options in xcodebuild's man page.

-only-testing:TEST-IDENTIFIER       

constrains testing by specifying tests to include, and excluding other tests

-skip-testing:TEST-IDENTIFIER       

constrains testing by specifying tests to exclude, but including other tests

What I try:

xcodebuild -workspace MyWorkSpace.xcworkspace / 
-sdk iphonesimulator / 
-destination id=7F52F302-C6AF-4215-B269-39A6F9913D5B / 
-scheme SCHEME-iOS / 
test -only-testing:???

What is TEST-IDENTIFIER mean ?

解决方案

Like what Marcio said, it's a path like string.

For example, say you have a scheme named MyScheme, a test target MyUITests, and testing class LoginTest, then testing method testUserLogin, to run only the method, you can run

xcodebuild -workspace Envoy.xcworkspace \
    -scheme MyScheme \
    -sdk iphonesimulator \
    -destination 'platform=iOS Simulator,name=iPad Air 2,OS=10.1'
    '-only-testing:MyUITests/LoginTest/testUserLogin' test

Likewise, if you want to run all tests under LoginTest, here you run

xcodebuild -workspace Envoy.xcworkspace \
    -scheme MyScheme \
    -sdk iphonesimulator \
    -destination 'platform=iOS Simulator,name=iPad Air 2,OS=10.1'
    '-only-testing:MyUITests/LoginTest' test

这篇关于如何将 xcodebuild 与 -only-testing 和 -skip-testing 标志一起使用?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆