How to use one XCTestCase class for many targets

123 views Asked by At

I have white label project (many app's on one source code). Usually I reuse one ViewController for many targets, but to test this ViewController in different targets I must add: @testable import TargetName

I have tried to create Swift Compiler - Custom Flag with:

  1. -D TARGET_TEST1
  2. -D TARGET_TEST2

and use:

//
#if TARGET_TEST1
@testable import TARGET_TEST1
#else
@testable import TARGET_TEST2
#endif
//

For testing in Xcode it's work, but if I start this on Xcode Server, I have error:

Use of undeclared type 'NameOfClass.swift'

Is it any other options how to provide @testable import for specific test target?

0

There are 0 answers