Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Xcode : One test target for multiple app targets

I am wondering if you can link one Unit Testing bundle to multiple targets. So one can test all the application targets with one Testing bundle.

I have some shared code between all app targets but also some specific calculations based upon which app target is running.

Currently I have to set the Bundle Loader option in the Build Settings to the used application target's .app file if I want to test a different application target.

My question to you all is : can this be done without creating multiple test bundle targets for every app target, and without always changing the Bundle Loader option?

like image 458
Yannick Avatar asked Nov 28 '12 07:11

Yannick


People also ask

How do I run a single test in Xcode?

In Xcode 5 you can run a single test case by clicking the little play button that you can find next to the test in the test navigator or next to the test method in the editor. In both places it shows up when you hover over it.

What is aggregate Xcode?

Aggregated Targets is used when we need to build multiple targets together somehow. We will start by our example FruitBasket from the previous article and you can download it from this git repo, here is a preview of the code we have in there.


2 Answers

You need to:

  • Select the target you want to test
  • Go to Test navigation tab
  • Right-click on test target you want to enable
  • Click on Enable [name_of_your_target]

enter image description here

like image 185
Garba Avatar answered Sep 20 '22 21:09

Garba


No, at this point you can't. It's like the extensions, you have to create a new one for each project's targets you have.

It's not pretty usefull but if the code differes from one to another target, the tests can fail because of missing code, not failing code.
It's why it's not allowed.

Sorry for the negative answer.

like image 32
David 'mArm' Ansermot Avatar answered Sep 20 '22 21:09

David 'mArm' Ansermot