Posts Tagged ‘Xcode 4.6.2’

Application Unit Testing from command line on iPhoneSimulator.

June 6, 2013

It’s hard to tell the reasons behind not supporting application-hosted tests on IPhoneSimulator and the infamous warning message:

/Applications/Xcode.app/Contents/Developer/Platforms/iPhoneSimulator.platform/Developer/Tools/RunPlatformUnitTests:81: warning: Skipping tests; the iPhoneSimulator platform does not currently support application-hosted tests (TEST_HOST set).

But people need to do this and there are solutions to this problem on the Internet, especially here. The solution seem to work in Xcode 4.5 but things seem to be changed slightly in Xcode 4.6 (4.6.2).

In version 4.6.2 script :

/Applications/Xcode.app/Contents/Developer/Platforms/iPhoneSimulator.platform/Developer/
Tools/RunPlatformUnitTests

seems to have bash script method RunTestForApplication redefined:

### Simulator app testing isn't supported, so redefine RunTestsForApplication.
RunTestsForApplication() {
Warning ${LINENO} "Skipping tests; the iPhoneSimulator platform does not currently support application-hosted tests (TEST_HOST set)."
}

So in addition to the solution linked above this method needs to be commented out in this file. Also please make sure that You somehow append -RegisterForSystemEvents flag to the test command run. You can do this either in a way described in the cited article or by adding the following line:

export OTHER_TEST_FLAGS=-RegisterForSystemEvents

after line 124 of
/Applications/Xcode.app/Contents/Developer/Platforms/iPhoneSimulator.platform/Developer/Tools/RunPlatformUnitTests,
otherwise You will end up with the following error:

Couldn't open shared capabilities memory GSCapabilities (No such file or directory)
Couldn't open shared capabilities memory GSCapabilities (No such file or directory)
Couldn't open shared capabilities memory GSCapabilities (No such file or directory)
Terminating since there is no system event server.
(Run the EventPump or pass the argument "-RegisterForSystemEvents" if you want to run without SpringBoard.

Advertisements