My project's unit test fails even before running!:
I've cleaned the build director, restarted simulator, tried on the device, disabled code signing, restarted Xcode...everything!
I cmd-u, cmd-ctrl-u, and it fails immediately.
I use CocoaPods, so run it in a workspace.
It works now, after restarting the computer!
Weird.
Related
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)".
I'm implementing unit test in Xcode 13 (13A233). I wrote simple test but my xcode fails running test on this project. On other projects it's running fine. It produces an error
Assertions: System: Test runner never began executing tests after launching. If you believe this error represents a bug, please attach the result bundle at /Users/apple/Library/Developer/Xcode/DerivedData/MunchON-eeidlzwuounsfvbrmieuosqzpsih/Logs/Test/Test-MunchON (Staging)-2021.10.05_11-35-54-+0500.xcresult
I'm unable to resolve this issue. Other questions that i have checked already:
http://twobitlabs.com/2011/06/adding-ocunit-to-an-existing-ios-project-with-xcode-4/
Xcode 4.2, can't run unit test
OCUnit tests not running / not being found
OCUnit test cases not running
Try deleting DerivedData
Open Xcode > Preferences > Locations
Click on the arrow to open DerivedData folder
Delete all from DerivedData folder
Reopen Xcode project
P.S. DerivedData contains cached data such that indexed files etc
FYI It is safe
I had a similar problem and solved it by checking the "Allow testing Host Application APIs" option in the test target.
I've set up jenkins on my local machine. Than I created a sample app with one failing and one succeeding unit test. When I issue the following command in the terminal
xcodebuild -scheme 'SampleWithTest' -sdk iphonesimulator7.0
-destination platform='iOS Simulator',OS=7.0,name='iPhone Retina (3.5-inch)' clean test
than it clean build the project, starts the simulator and makes the tests. This is how it should work.
When I run the same command via jenkins, it clean builds the project and ends with ** TEST SUCCEEDED ** without starting the simulator or print out the test results. Jenkins just fakes, that the tests was successful.
I test it on my local machine. Nothing headless, remote, source control, slave, code signing or whatever could make any trouble.
The Jenkins Xcode Plugin has not been updated to work with Xcode 5 and the XCTest framework. See this issue. Jenkins and the Xcode Plugin do not understand XCTest output.
Additionally, Xcode 5 changed how Xcode interacts with the simulator and devices when running tests. While there is something like a "headless mode" now for the simulator, access to that functionality isn't available to the Xcode plugin. This means that in some cases, it looks to the Xcode plugin as if the tests run and exit immediately, which is not accurate.
Xcode is known to be pretty tricky to setup with Jenkins, Travis or other non-Apple CI solutions.
Unit Tests support is even worse so you should try using xctool instead.
Related blog entry here.
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
For some reason, UIAutomation doesn't want to run on my physical device. I've gotten to run once, but otherwise when I kick it off, it simply sits there reporting "Script has stopped".
I've checked the following:
Using a developer profile to code sign
Several different cables, including a first party Apple one
Restarting my Mac and the iPad
Cleaning and rebuilding
Other instruments work just fine, I can run allocations and leaks without any issue, automation just refuses to run.
I had the same problem and then (eventually) figured it out.
Turns out the build has to be a DEBUG build so that instruments can attach to it. I edited the scheme build settings for "build for profiling" so that it would build a DEBUG build rather than a RELEASE build and things started working.