'UI Testing failure - App state is XCApplicationStateRunningActive not XCApplicationStateNotRunning

I am using XCUI tests to automate testing of some of the flows in our application (~35 test scenarios) with Xcode 7.2.1

Running these tests locally will consistently pass, whereas running them on our virtual machine instance (Parallels, Mac mini, OSX 10.11, 8GB RAM) will fail at different parts in the process.

I would get errors such as:

UI Testing Failure - App state for <XCUIApplicationProcess: 0x7ff661528a50 (null) (6798)> is XCApplicationStateRunningActive (3), still not XCApplicationStateNotRunning (1)[0m

I have turned off animations within the application, and also put significant waiting times throughout the application to try and cater for the slower running, but to no ends.

Has anybody had any similar problems with running XCUITests and the termination of the simulator when running them?

Any help would be great.



Sources

This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.

Source: Stack Overflow

Solution Source