Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How to use xcodebuild with -only-testing and -skip-testing flag?

Tags:

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 image 621
Zigii Wong Avatar asked Sep 10 '16 14:09

Zigii Wong


People also ask

How does Xcodebuild work?

In general, Xcode has to do tasks like preprocess source files and compile them by compiler, link source code by linker, copy and process resources like headers, asset catalogues and storyboards, And finally code sign and maybe even do some custom work in a shell script or a make file like building API documentation ...

What is Xcodebuild command?

xcodebuild is a command-line tool that offers the ability to build and test your Xcode projects.

What does Xcodebuild archive do?

It archives your Xcode project by running the xcodebuild archive command and exports the archive into an . ipa file with the xcodebuild -exportArchive command. This . ipa file can be shared and installed on test devices, or uploaded to App Store Connect.


1 Answers

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 
like image 199
Fang-Pen Lin Avatar answered Sep 30 '22 18:09

Fang-Pen Lin