Reputation:
I understand that a similar question was asked before, however the provided answer does not cover Xcode 5. I understand that the TEST_AFTER_BUILD setting is obsolete in Xcode 5 (see unit testing - RunUnitTests error after Xcode 5 update) This naturally leads to my question: how exactly do I automate unit testing after each build, now that the setting is obsolete.
Very specifically:
This was working in Xcode 4; see link above to understand how the 'old way to do it' is now broken.
This is a MIGRATION issue. I do not need a general (and possibly out of date) tutorial on unit testing in Xcode.
Upvotes: 4
Views: 3088
Reputation: 2918
I maybe have a useful link for you:
http://meandmark.com/blog/2013/09/xcode-5-unit-testing-changes/
specially the part: XCTest
This was working in Xcode 4; see link above to understand how the 'old way to do it' is now broken.
You point to a possible solution for Xcode 5, even if I don't know if its a proper answer.
Maybe you should point out your problem a little closer...
test scheme
of your project? Have you tried to configure the right Pre-action and checked your test settings?
Upvotes: 1
Reputation:
While I really hope for something more streamlined and better integrated, the closest I got to fixing the above is:
To add a build phase, open the target we are adding a build phase to, then use the menu item:
editor > add build phase > add run script build phase
The custom script calling xcodebuild looks like this:
cd DIR
xcodebuild -workspace MY_WORKSPACE.xcworkspace -scheme MY_SCHEME -destination ‘platform=iOS Simulator,name=iPhone’ test
...
where:
DIR - the directory containing my workspace.
... - repeat command invocation for every library being tested.
( Added some info on my blog )
This is far from perfect but for lack of anything better, it does a job. Thanks for posting if you have a better solution.
Upvotes: 1
Reputation: 2186
Select the project from the project navigator to open the project editor. Select the project or target on the left side of the project editor. Click the Build Settings button at the top of the editor. The Test After Build build setting is in the Unit Testing collection. Then Set the Test After Build build setting to Yes. Choose Product > Build For > Build For Testing to build the project and run the tests. I got this form the answer to a similar question here.
And please see this tutorial for beggining automated testing.
Upvotes: 0