Xcode 14 unit testing clone simulator - xcode14

In Xcode 14, running unit testing seems to be creating simulator 'clones' (named 'Clone 1/2.. of iPhone').
On older machines, this can take a long time. This is happening every time when switching from running the App and running tests.
For example, running the App will launch the Simulator. Running tests will launch new one or more Simulators (Clone of ...), and running the App again will reload the original Simulator.
Any way to control this? This makes running tests a real pain on older machines.

There is a setting for this in the Xcode build scheme. Click the scheme name in the toolbar of your project window, then go to Edit Scheme -> Test -> <your Test target> -> Options... and uncheck "Execute in parallel (if possible)".

Related

App closes automatically when not ran from Xcode

I am developing an app using react native.
When I test it on iOS device connected by USB (when I run from Xcode Integrated development environment). It works as expected. But if I unplug USB cable, the app is still on the phone, can be opened but only displays "NameofTheApp - Powered by React native" and shuts automatically after 10 seconds.
I have following questions
Is it normal as it is only on development mode
Is it a bug which i have to fix before releasing app?
This happened because when you run from the XCode, it has two modes.
1. Debug
2. Release
The crash happened because you were running in release while running xcode.
While running in Xcode, edit schema and set the mode as debug as follows:
Choose Product -> Scheme -> Edit Scheme. Change the Build Configuration under the Info tab to debug.
For me I had the 'debug executable' checkmark checked.
This is at Product -> Scheme -> Edit Scheme,
Select Run section on left side, info tab and verify that debug executable is Unchecked
You are trying to run the debug version which is unusable after USB debugging because it got disconnected from the server. You need to run it in production mode. Here is how to do

Can we run ios release build on simulators for Automated tests

I tried to run the release build app in Simulator, but it is being crashed after opening. After some exploration, I came to know that we can't run release build which is built for the device on iOS Simulator
Here my use case is that I want to run automated tests without building two times (One is for Simulator, Another one is for Actual device ) in CI as it will take double the time to get the build to succeed.
So I want to know whether there is any solution where I can build only once and test it in the simulator and distribute it.

Xcode 9.1 with fastlane not running headless

I'm running fastlane scan for our UI Tests on a iPad Air 2 iOS 11 simulator and my understanding from this article https://dzone.com/articles/new-xcuitest-features-with-xcode-9-hands-on-explor is that it should run headless automatically.
But it's launching the simulator every time. Is there a xcargs that needs passed to make it run headless.
I don't see anything in the fastlane docs for scan that relates to headless.
Just close the simulator application before you run xcodebuild. Conversely, if you want to see the simulator during tests, start the simulator beforehand via Xcode -> Open Developer Tool -> Simulator.

Build with release configuration but automation tracetemplate launch app from simulator show target app not frontmost

Xcode version is 5.0.2 with latest iOS system.
I changed run's scheme build configuration to release, then click Run to build app, after that:
I open instruments and select automation tracetemplate , select target app
Then add an new script
Click Record button
After app started from simulator, the instruments show an error message: Target app not frontmost;
But when I changed run's scheme build configuration to debug, it works fine.
Note: Code Signing using iOS Developer both debug and release.
In XCode (not in Instruments) select Product > Profile, and after if compiles, choose automation. Wait for the app to start, then stop the track: you should be able to run it from the editor. If not, delete the Instruments and iPhone Simulator folders from the Library and restart Instruments.

Xcode 5: Multiple test targets in one scheme: "Simulator already in use"

In Xcode 5, I have a workspace with multiple projects and a scheme that should run all the test targets of the various projects. When I kick off the tests about 3 test project targets pass. So far, so good. But at the fourth test target I get an error message from Xcode telling me that the simulator can't be launched because it is already in use.
Is there any way to kill the simulator between each test target(!) in a single(!) scheme?
Or are there other solutions?
Edit: I have opened a rdar for this: http://openradar.appspot.com/15153136
Thanks!
I have come into this error whenever i try to run my functional tests using calabash. One way to do this maybe be to run a script in the after each build process to kill the simulator.
this guy has wrote a bash script that does this
http://cdrussell.blogspot.co.uk/2012/04/script-to-kill-iphone-simulator-if.html
Might be worth running this as a build phase for each test target

Resources