Search code examples
iosxcodeswiftunit-testingxctest

Testing two targets with same tests


I had a project with 3 targets:

  1. The app target
  2. Unit tests target (host app >> 1.)
  3. UI tests target (target app >> 1.)

Now, after I added a new app target for a different branding (with slight changes):

  1. The app target
  2. The new app (new branding)
  3. Unit tests target (host app >> 1.)
  4. UI tests target (target app >> 1.)

I realised that the unit and UI tests have specific target applications. For the new app, 90% of the tests will be the same. Is there a way to setup the test targets to run twice, once for each of my apps/brandings? (maybe with extern tools?)


Solution

  • After some time I found out that what I needed was different targets.

    These are my targets now:

    1. The app target
    2. The new app (new branding)
    3. Unit tests target (host app >> 1.)
    4. UI tests target (target app >> 1.)
    5. Unit tests target (host app >> 2.)
    6. UI tests target (target app >> 2.)