Trying to setup continuous integration for my iOS app. Wrote bunch of unit tests that run fine locally for both phone and simulator.
However, when I run my CI bots the tests are failing with this error:
" Test target X encountered an error (Early unexpected exit, operation never finished bootstrapping - no restart will be attempted) "
There is no more explanation to be found in the logs or anything like that. The bot is set up to use only iPhone 7 iOS 11.2 simulator.
Any kind of help is highly appreciated.
EDIT: I partially fixed this issue by changing Runpath Search Paths on my Test target in Build Settings to $(FRAMEWORK_SEARCH_PATHS).
However, I still get this error if I use more than one simulator on the bot :( So if I use only one simulator everything works fine, but if I use more than one it would fail for all of them or at least for one of them with this same error...
Related
I recently started working on an old ios app which doesn't have unit tests. I am not an ios developer myself. Due to circumstances I feel compelled to start writing unit tests.
App has multiple dependencies added using cocoapods. One of them is a framework which we maintain ourselves.
I am trying to run the dummy testExample that is auto-generated while creating a project. It doesn't have any code.
When I run the test xcode builds & installs the app. App shows the splash screen. But after that nothing happens.
I also tried running the test from command line in case it would print any errors. But it shows
Testing started for configuration 'Configuration 1'
and stops.
I have tried all the remedies I could find on stackoverflow and apple's forum. Typical ios project troubleshooting like deleting folders, etc. have also been tried. I am completely stuck without any error message.
I tried running the dummy test in a newly created project on the same xcode & device and it ran.
How can I debug this issue? Is something in the app code stopping the unit tests from running. How can I make sure that all the right checkboxes are checked and the build configs all correct? Is there a comprehensive list somewhere of steps required to set up unit testing?
Xcode version - 13.4.1 Test device - iphone 11, ios version 15.6
I'm in a very early stage of developing an iOS application, and right now, I just want to test the logic of my Swift code. I don't care about the actual app yet. I've written some unit tests in my tests file, but whenever I run the test suite, it launches the simulator with an iPod Touch as the target device, even though it has nothing to do with my tests for now. Is there a way to disable that?
I've tried going to Project > General and setting the Host Application to 'None' for tests, but it doesn't seem to be doing anything. And I don't know if this is relevant but I also turned off AuthenticationUITests under Product > Scheme > Edit Scheme.
This was the most relevant post I could come across regarding this topic, but it seems to be outdated because I can't find Bundle Loader and Test Host in that place anymore.
I also tried using xctool as per this post, but when I try brew install xctool, it says:
Warning: xctool has been deprecated because it has an archived upstream repository!
Error: xctool: no bottle available!
I'm trying to test my Xamarin.Forms app with Xamarin.UITest. Android works fine, but the iOS part has problems. When executing my first test to get into REPL I get the following error:
SetUp : System.Exception : Unable to contact test backend running in app. A common cause is that the app is not properly linked with Calabash. Please verify that it includes the Calabash component.
The strange thing is, when uploading the app to the Microsoft App Center it starts a test. It just hangs because it fails to find my toolbaritems. I wanted to check for a valid query with REPL by doing the iOS test on my Mac, while I'm usually working on Visual Studio on Windows.
I tried the solutions I found online with no luck
My .iOS project includes the Xamarin.TestCloud.Agent
In the AppDelegate.cs I have Xamarin.Calabash.Start() directly after global::Xamarin.Forms.Forms.Init().
I have NUnit 2.6.4 and NUnitTestAdapter 2.1.1 in the UITest project
I am using my Debug/IPhoneSimulator configuration
I am compiling an .app file from Visual Studio on Windows connected to a Mac and start the iOS test on the Mac.
This is my current code for the AppInitializer:
return ConfigureApp.iOS.AppBundle(sPathToiOS).PreferIdeSettings().StartApp();
Sometimes I also get a different error:
SetUp : Xamarin.UITest.XDB.Exceptions.DeviceAgentException : Unable to contact DeviceAgent
----> System.AggregateException : One or more errors occurred.
----> Xamarin.UITest.XDB.Exceptions.DeviceAgentException : Unable to contact DeviceAgent on 127.0.0.1
----> System.Net.Http.HttpRequestException : An error occurred while sending the request
----> System.Net.WebException : Error: ConnectFailure (Connection refused)
----> System.Net.Sockets.SocketException : Connection refused
This seems to be happening when the simulator is not running when starting the test and it takes to long to start the simulator.
I had to make sure I had re-deployed the app onto the simulator I am going to test on, with all the necessary steps in place.
What happened to me specifically is that I added the Xamarin.Calabash.Start() to the AppDelegate.cs file, but I had to make sure to redeploy to the simulator (by just starting the app in debug mode in my case), exiting out, then starting up the UI test(s).
This will ensure that the correct version of the app is on the simulator. This is the only way to test on the simulator; it won't deploy the app for you before running the tests.
So if someone has a similar problem like me and comes into this question: My solution is to connect a physical device to the the Mac and run my UI-Test on it. Keep in mind that you have to activate UIAutomation in the developersettings on the device. Now I can run my tests with no problem.
In my case, Calabash was not included in the build of my Xamarin.iOS solution when running my Xamarin.UITest.
I've fixed my problem by following this documentation :
adding Xamarin.TestCloud.Agent in the Xamarin.iOS project
launch Xamarin.Calabash.Start() in AppDelegate.cs file
In my case Xamarin.Calabash.Start() was under a preprocessor directive (#if TEST) that was not executed. Just make sure the directive is in place to solve the issue
I've been getting this error in Xcode 10.1 when running unit tests. It happens quite often.
When running unit tests in Xcode, test might pass or fail a few times. Then, after a few runs, this error appears, with Xcode not being able to launch or communicate with the iOS simulator.
Selecting a different simulator from the list is a workaround, but it gets a bit annoying having to do so. Furthermore, after a few unit test runs in the new selected simulator, the error comes back (with a different UUID).
Closing the simulator app and running the tests again does not solve the issue (same error alert appears). Neither does closing and reopening the project.
One thing noticed is, when Xcode gets in this state, closing Xcode (quitting the application) takes longer than usual. Closing Xcode and relaunching it, then running unit tests, also does fix the issue.
Window -> Devices & Simulators
Delete simulator
Add same simulator
Run tests again
I've got an annoying issue with UnitTests in Xcode 8.1.
Trying to run a basic test on my iPad iOS 10.1.1 causes a crash due to the following error:
dyld: could not load inserted library '__PLATFORMS__/iPhoneOS.platform/Developer/Library/PrivateFrameworks/IDEBundleInjection.framework/IDEBundleInjection' because image not found
I have yet to find a solution anywhere though some posts have suggested it could be related to the Code Signing for the unit test target. The code signing looks correct, the tests clean build, I deleted derived data, still seeing this error.
No amount of restarting or signing fixed this for me. Only thing that works seems to be turning off debugging.
Do this for each scheme on iOS targets. The implication is that you won't be able to step into your unit tests on devices with the debugger.
Hence, this is really a work-around, not a solution, but I'm posting it anyway as the checkbox is sufficiently obscure that it took me a while to try this and find my test would now run on the device.
I have Xcode bots running for continuous integration, and a real device plugged into my CI machine, so I need this to work.
I'm not sure if its an Xcode bug: if folks think it is then I'll make a report.