Frage

I've created several static libraries that are shared among multiple iOS projects. In a lot of these static libraries i've created unit tests. I'd like these tests to run whenever I test the project that the static library is included in.

I've tried including all of the tests inside of the "Test" section in the main projects scheme but this usually results in "Simulator is already in use" errors and the tests fail. Probably because the previous tests are using the simulator.

scheme-tests

Skin CreatorTests are for the main project

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

Am I going about this the right way, or should I be thinking differently?

** EDIT **

Looks like this stack overflow question is having the same problem.

Xcode 5: Multiple test targets in one scheme: "Simulator already in use"

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

War es hilfreich?

Lösung

Although correctly setting up your Unit Testing is pretty much a mess and a time sink on XCode (thanks to the very clear messages you get, as you found out), in your case I think the problem is your approach.

If you have several static libraries linked from multiple projects, the tests for the static libraries should not be run from the projects referencing them. Each library should be self-contained and pack it's own tests, and they should be run whenever you change something in that particular library.

The idea is that you should only be testing your own code. If you link an external static library, that library's author is responsible for correctly unit testing this portion. The fact that you're also the author of the external library should not have an impact on this.

Lizenziert unter: CC-BY-SA mit Zuschreibung
Nicht verbunden mit StackOverflow
scroll top