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
Related
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!
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...
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.
I'm trying to figure out how to do automated UI testing so that I can test my app for regression errors as I make changes and such. I'm following the instructions found in Apple's documentation. I built my app in Xcode and it is running in the iOS simulator.
I opened Instruments and chose the iOS Automation instrument. However, I can't seem to figure out how to get Instruments to run the script on my iOS app in the sim. When I first create the Automation instrument the target drop down just says "lkj" but if I try to choose the sim as my target, it tells me that the Automation instrument doesn't allow attaching.
How do I get Instruments to run my test on my iOS app?
I tried just running it with the "lkj" target selected and I got a weird error involving some random guy's name (I'm assuming he's a dev for Instruments or something?)
Path not found
'/Users/jonathan_morgan/Library/Developer/Xcode/DerivedData/lkj-randomstringofcharacters/Build/Products/Release-iphonesimulator/lkj.app/lkj
The simplest way to attach your target to the simulator and run your UIAutomation scripts is to profile the app. Xcode - Product - Build For - Profiling and then select the Automation template.
Another way to attach the target, if you've already built the app on your simulator. Is to select Choose Target and then go to the following location /Users/[yourUserName]/Library/Application Support/iPhone Simulator/[iOSVersion]/Applications/[AppFolder]/[NameOfYourTarget]
For more info, you can take a look at this blog which is pretty detailed http://blog.manbolo.com/2012/04/08/ios-automated-tests-with-uiautomation
Hope it helps.
I am having a consistent problem with multiple different apps that the build on the device does not update when I make code changes. Here's my set up:
OSX Lion
Xcode 4.1
iOS 4.3.5
I build, and then run, the app launches on the device but it still runs the last installed version. In order to get the build to update, I have to do the following...
Remove the app from the device (press and hold on the icon, and click the x)
Clean and then build in Xcode
At this point if I try and run the app does not run. Xcode log says the app has started and stopped. If I restart Xcode and run, then the app runs successfully and is the updated version
If I make a single line of code change I have to go through all the steps above to get the app to update. The project is very large so a clean build takes 2-3 minutes.
Any ideas?
Update
I found the solution, this is related to the use of static libraries. The following article helped me solve this:
Changing the source of a static library needs clean and build in xcode 4
and for general background this was very helpful too:
http://blog.carbonfive.com/2011/04/04/using-open-source-static-libraries-in-xcode-4/
Double check your provisioning files and targets. Be extra sure to check the App ID in your targets, and Bundle ID in info.plist. Did you change any of that info before you saw this problem? I've noticed strange behavior like what you mentioned when updating those specific pieces of data.
Command+Shift+K -- Clean. I have found that you have to do a manual clean every time now to ensure that the build updates correctly.
In the event that xCode does not run at all, you just have to restart xCode.