How can I use Xcode bots to test iOS apps that connect to HTTPS test servers with a self-signed certificate?

I am developing an iOS app which communicates with my HTTPS servers. In production my servers have valid 3rd party issued certificates and everything works fine. In my test environment, my test servers use certificates I've issued from my self-signed CA.


In order to test my app manually I can install the CA root certificate on all my test devices per the instructions here: https://developer.apple.com/library/archive/qa/qa1948/_index.html


How can I do something similar for the simulators used by my XCode bots?


Also I've noticed that every time I install an XCode update that bumps my max iOS version I have to re-install the CA root cert on all of my devices.


Installing the root cert on a few devices is fine, but it is pretty onerous for many devices / simulators, especially since you have to do it all the time as iOS updates happen.


Is there an automated way of doing this? I used to use a UI test to automate the CA cert installation precess similar to this post https://stackoverflow.com/questions/46940888/how-can-i-automatically-install-a-custom-ca-root-certificate-on-my-ios-simulator(which I wrote), but it not longer works in iOS 12.2.

Replies

Through some experimentation I have found that I can log in to the account on the server running the XCode bots, start XCode and launch the simulator. Then I can start each and every simulator I want to test with and install my root certificate. And then the next time and XCode iOS upgrade comes out I can do it all over again. It seems like I've missed some critical step here. Is anyone else testing iOS app code against test servers with self-signed certs?