Keep the iPhone Simulator in the background while running tests in Xcode?

Solution 1:

Currently, it seems that there is no support for this in Xcode or the iOS Simulator. There are a few workarounds listed here.

StackOverflow how to run tests without launching iOS Simulator

Personally, the easiest thing for me has been to use a secondary monitor, but if that is not an option, some of the other suggested workarounds are:

  1. "Command + U, followed by Command + H when launching unit tests. (Control + H hides the simulator after it appears.)" - markshiz

  2. Don't set any bundle loader or test host build settings, instead just add the .m files you are unit testing to the Build Phases Compile Sources, then run the unit tests from the command line using:

xcodebuild -verbose -target TheElementsUnitTests -configuration Debug -sdk iphonesimulator5.0 clean build

-MandyW

  1. Run an AppleScript in Generates output in Testing behavior configuration:

#!/usr/bin/osascript activate application "Xcode"

-Rudolf Adamkovic