user2665402
user2665402

Reputation: 169

Running Xcode target from command line

I am new to running unit tests using Catch.

I am using the Catch to run unit tests in my Xcode project. I have added a target to my project which includes my Catch files and tests cases. Selecting that target and running from Xcode runs fine. I am now trying to get it to run from the command line which will be the way it is run from Jenkins. I have a shell script that contains:

xcodebuild clean install
xcodebuild -target TestApp  -configuration “Debug”  -sdk iphonesimulator7.1   CONFIGURATION_BUILD_DIR=TestBuild ONLY_ACTIVE_ARCH=NO

The result is:

** INSTALL SUCCEEDED **

Build settings from command line:
    CONFIGURATION_BUILD_DIR = TestBuild
    ONLY_ACTIVE_ARCH = NO
    SDKROOT = iphonesimulator7.1

--- xcodebuild: WARNING: Configuration “Release” is not in the project. Building default configuration.

=== BUILD TARGET CreativeSDKTest OF PROJECT CreativeSDKImage WITH THE DEFAULT CONFIGURATION (Release) ===

Check dependencies

** BUILD SUCCEEDED **

But the application doesn’t launch in the simulator. Maybe I’m not seeing the obvious but from all the docs I’ve read, this should launch the application.

Upvotes: 6

Views: 6199

Answers (1)

Rich
Rich

Reputation: 8202

I think you'll need to tell xcodebuild to test the project:

xcodebuild clean install
xcodebuild -target TestApp  -configuration “Debug”  -sdk iphonesimulator7.1   CONFIGURATION_BUILD_DIR=TestBuild ONLY_ACTIVE_ARCH=NO clean test

(See the end of the last command)

EDIT: In fact you probably don't even need the first command and just the second will do.

Upvotes: 1

Related Questions