
This video is only available to subscribers. Start a subscription today to get access to this and 472 other videos.
Smart JSON Parsing
Episode Links
- Episode Source Code
- test.rb script (to run tests with color from the command line)
Running Unit Tests from the Command Line
This is, unfortunately, not properly supported. There are a few hacks to get this to work, including the one mentioned here:
http://www.raingrove.com/2012/03/28/running-ocunit-and-specta-tests-from-command-line.html
The solution recommended here, however, is to modify a system script, which is not something I usually like to do.
Instead here are the steps I followed:
- Create a new scheme called RunTests based on your unit test target (or whatever you'd like)
- Edit the Scheme and click on the Build action. Make sure that your test has "Run" checked
- Remove the Test Host setting from the target's build settings.
- (optional) Uncheck "Output Environment Variables" from the Run Script Build Phase for running the tests
Then run this in Terminal:
xcodebuild -workspace MyWorkspace.xcworkspace -sdk iphonesimulator TEST_AFTER_BUILD=YES clean build
If you get an error about "No active architectures", then you can add ACTIVE_ARCH_ONLY=NO
.
Once this works, you can use the gist linked above.