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