How to Unit Test a project with Multiple Configurations

Zonily Jame

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

Configurations

The error message generated for this is No Such module <product module name> and that's because of the different $PRODUCT_NAMEs 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.

enter image description here

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

Zonily Jame

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

Collected from the Internet

Please contact [email protected] to delete if infringement.

edited at
0

Comments

0 comments
Login to comment

Related

How to use multiple configurations with logback in a single project?

How to unit test a vsix project?

Multiple Project Configurations C++

Gradle : Multiple configurations for Test tasks

How to add an assembly reference in unit test project?

Unit tests project with multiple application and databases - Circular dependency in TEST[DEPENDENCIES]

how to make connection between visual studio project and unit test project?

How to unit test a class with multiple boolean fields

How to mock multiple components in camel unit test?

How To Unit Test Multiple Instances Of Class In xUnit

how to test wcf rest services in vs "unit test project"?

How to build multiple configurations in VisualStudioOnline?

How to determine which .net unit test framework a project is using?

How to get path in project folder from unit test

Unit testing Episerver - how to add a block to a content area in the test project

How to generate unit test cases in VS 2017 .net core project?

python project import uwsgi how to do unit test?

Unit test large Qt project

Unit test class for Swift project

VSTS - REST API - Assign Test Case to multiple Test Configurations

In Eclipse, how to have launch configurations relative to the project?

Jira: how to retrieve a list of field configurations for a project

How delete run/test configurations in pycharm?

How do I write unit test for logic apps steps using Ms unit project c# code?

How to write Pester Unit Test for ranges of values with multiple decimals

How should I unit test multiple required fields in C#?

How efficiently unit test a function with multiple input calls?

How to test change unit in mongock with its multiple attributes/lifecycle methods?

Implementation of Unit test and acceptance test in a .NET project