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.
in file window go to search input field and type 'terminal' and click on its icon when you find it. Now you should see 'Terminal. app' in 'Executable' field. go to the 'Arguments' tab, click on + and copy and paste this line there: ${BUILT_PRODUCTS_DIR}/${FULL_PRODUCT_NAME}
You can access Target Membership by selecting file and opening the right menu in Xcode (the menu is called Inspectors ). Then, in File Inspector at the bottom of the menu, find Target Membership . It's very important to check all files in your project because without this you won't be able to build a new app target.
Open your scheme (⌘<) and select the Run > Arguments tab. Add the arguments you want to pass on launch one at a time. Double-click to edit any argument: The arguments are vended by CommandLine.
Installing XcodeType “gcc” into the terminal and hit “Enter” (gcc is a compiler that turns source code into executable applications). Alternatively, typing “xcode-select — install” into the terminal works just as well.
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.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With