How to dynamically change the target for unit tests in Xcode 7?

I have a project with several different goals / schemes (38 of them are written), and I'm trying to get unit testing that works correctly for all different purposes. Everything works for me with one goal, and I tried to add my testing goal to all the different schemes, but it seems that when the tests are run for each scheme, they actually run on the same source target.

Looking at the project file, I see that there is a specific host application associated with my test target, and in the build settings the Bundle loader and test node point to the same Host Application.

Is there a way to override these values ​​for each circuit to run tests against the current goal of constructing the circuit? Or is there any other way to set up one target test task to accomplish multiple build goals?

+5
source share
2 answers

If you run tests from the command line or from a CI tool such as Jenkins, you can specify xcodebuild to use create the settings you provide. A simple use case would be:

xcodebuild -scheme SomeScheme test TEST_HOST=target 

You can control almost (if not any) build settings from Xcode, such as code generation, build directory, derived data directory, code identifier, etc.

+5
source

You can select a circuit when running tests with the Xcode server.

Take a look at WWDC 2014 while continuing to integrate to walk through the setup

https://developer.apple.com/videos/play/wwdc2014-415/

It uses Xcode 6 but is very similar to Xcode 7

Also check out this CI recommendation (continued integration) from apple https://developer.apple.com/library/ios/documentation/IDEs/Conceptual/xcode_guide-continuous_integration/adopt_continuous_integration.html

+1
source

Source: https://habr.com/ru/post/1239527/


All Articles