Unable to execute tests from command line via xcodebuild

Sunny picture Sunny · Nov 27, 2013 · Viewed 14.8k times · Source

I am trying to build and run test cases using command line for iOS test cases. I have given the following command:

xcodebuild -target AppEngineTests -configuration Debug -sdk iphonesimulator TEST_AFTER_BUILD=YES clean build

It builds the app but the testcases are not run.

could someone please help? Thanks

Answer

tooluser picture tooluser · Mar 11, 2014

I've found the name property to require more specification.

xcodebuild test -workspace #{WORKSPACE_FILE} -scheme #{TEST_SCHEME} -destination 'platform=iOS Simulator,name=iPhone Retina (4-inch),OS=7.0'

Was what finally worked for me. iPhone was limited and/or unpredictable.

As another poster (can't find the citation) mentioned, the 'platform' loosely corresponds to the divider in the target list, 'name' corresponds to the sub-selection, and the OS parameter corresponds to the right side of the chevron in the same list minus 'iOS '.

The documentation is suggestive and sounds authoritative on first glance without actually being full or correct, unfortunately.

Astonishing what a hassle this was. And how well it worked once the right invocation was achieved.