How to run tests from the iOS static library, your project depends on

I created several static libraries that are shared by several iOS projects. In many of these static libraries, I created unit tests. I would like these tests to run whenever I tested a project that includes a static library.

I tried to include all the tests inside the "Test" section in the main project diagram, but usually this leads to "Simulator is already in use" errors and the tests fail. Probably because previous tests use a simulator.

scheme-tests

Tests for creating a skin for the main project

SEUSUIKitTests, APIKitTests, PurchaseKitTests and MCSkinKitTests are all tests from the attached static libraries

Am I going to do it right, or should I think differently?

** EDIT **

This question seems to have the same problem.

Xcode 5: several test targets in one scheme: "The simulator is already in use"

** EDIT 2 ** Radar: http://openradar.appspot.com/15153136

+6
source share
1 answer

Although setting up Device Testing properly is pretty much a mess and time on Xcode (thanks to the very clear messages you get, as it turned out), in your case, I think the problem is your approach.

If you have several static libraries linked from several projects, tests for static libraries should not be run from projects that link to them. Each library should be self-contained and pack its own tests, and they should be run whenever you change something in that particular library.

The idea is that you should only test your own code. If you link an external static library, the author of the library is responsible for the proper unit testing of this part. The fact that you are also the author of an external library should not affect this.

+2
source

All Articles