Reputation: 5379
Inside the the TestCase files we always import the Product Name of the product we are testing, example:
@testable import FooApp
import XCTest
The problem that I have is that I have multiple Product Names because I have different configurations
The error message generated for this is No Such module <product module name>
and that's because of the different $PRODUCT_NAME
s that I have setup for my different configurations.
Is there a way I can make the @testable import
modular so that I can run my Tests on all of the configurations?
Below is an example of how I set my Product Bundle Id
, Product Module Name
, and Product Name
.
Is there a way I can do something like the example below?
@testable import SomeWildCardHere
import XCTest
Because the alternative would be to do something like the example below.
#if DEVELOP
@testable import App_Dev
#elseif STAGING
@testable import App_Stg
#elseif TEST
@testable import App_Tst
#else
@testable import App
#endif
Upvotes: 1
Views: 657
Reputation: 5379
I have found that the PRODUCT_MODULE_NAME
does not need to be different for each configuration. This would mean that I can just have just one import for all configurations. Though I'm not sure how what if there will be bad effects in the projects moving forward.
@testable import App // for all targets
Take Note: Don't change your PRODUCT_MODULE_NAME
for a production app because it strong text
Upvotes: 1