39

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?

Yannick
  • 1,076
  • 1
  • 11
  • 23
  • I've got a similar scenario now, did you get anywhere with this? – Ricky Feb 28 '14 at 05:07
  • Nope, we just stopped testing. :) – Yannick Feb 28 '14 at 12:36
  • I think you can create several Schemes and override `Bundle Loader` there – if my memory serves me right, there was a possibility to override arguments and environment variables for each Scheme and action (Run, Profile, Test) and so on. – ivanmoskalev Feb 28 '14 at 16:36

2 Answers2

7

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

Garba
  • 126
  • 2
  • 8
  • I could not find this option. But you can find more answers here: https://stackoverflow.com/questions/37697639/testing-two-targets-with-same-tests/71144697#71144697 – devjme Feb 16 '22 at 15:43
3

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.

David Ansermot
  • 6,052
  • 8
  • 47
  • 82