The following issue is a head scratcher if you are trying to add unit tests to your project that both run on Mac and iOS. And if you like to use the new inline buttons for executing individual tests.
Filed as rdar://15085316 and Open Radar. The mentioned sample project is the UnitTestTest sample on our Radar Samples GitHub repo.
Summary
I have an Xcode project with a UnitTest target for iOS and a MacUnitTest for OSX. The unit tests work on the respective platforms when run via Test. But the new inline checks where you can run individual tests only work for one platform at a time.
Steps to Reproduce
- Look at the provided sample app
- for each of the 3 schemes run Test (CMD-U) – works.
- open MacUnitTest.m while having the MacUnitTest scheme selected
- click on the red x next to -(void)testExample
Expected Results
The individual test case should be executed based on the currently selected scheme.
Actual Results
You get the message
“The run destination My Mac 64-bit is not valid for tests you have chosen to perform. Please select a run destination which supports the tests that you wish to perform”.
Version
Version 5.0 (5A1413)
Notes
if instead of the source browser look at the test case navigator you see that the tests from the currently selected scheme are black and the others are gray. If you switch between the UnitTest and MacUnitTest schemes these adapt and you are always able to execute the tests via the small play buttons.
This leads me to believe that here is a bug, since the inline test launch buttons should always match the currently selected scheme, like in the test navigator.
Configuration
10.8.5 iMac 27″
Categories: Bug Reports
I can confirm this. I have a multi-platform project with a shared framework and shared tests. This behavior drives me crazy. Did still not test it with XCode 5.0.1 (GM)