Reputation: 34798
how can I run Unit Tests in XCode4 without having to swap to UnitTest profile/target?
So whilst in normal "build / run on simulator" profile in XCode4, is there a way (e.g. shortcut key or otherwise) to kickoff unit tests which are set up in another target?
So from a XCode4 target view: * myAppTarget - where XCode is currently set to * unitTestTarget - would like short cut to trigger running of these
So effectively a way to automate the equivalent of: * switch Xcode to UnitTest target * run unit tests * switch back to normal myAppTarget
Upvotes: 1
Views: 810
Reputation: 141
It's worth noting that unit tests are quite different under Xcode 4 than they were with previous versions. As others have commented, the simplest way to have unit tests automatically setup in the Test action for a target is to select "Include unit tests" when creating the target. This creates an OCUnit bundle target, and automatically sets this up in the Test action of the scheme.
If you are converting an older project, you may want to remove the scheme automatically created for the OCUnit target, and edit the Test action in the scheme for the corresponding main target to add the tests from the OCUnit target. Any OCUnit bundles that are linked against SenTestingKit are available here. Should should then be able to run the unit tests with ⌘-U.
To select which unit tests are run for a scheme, edit the Test action for the scheme, where checkboxes are available for each test and test class.
Upvotes: 2
Reputation: 56
I'm not sure if its exactly what you mean but if you create a target that contains your Logic Tests you can set the logic tests to be executed on build, and put a dependency on your normal project to compile the Logic test project also.
That way you can force your project to run the Logic test whenever you build it.
Upvotes: 1