Don't launch simulator when running unittests

前端 未结 6 1436
悲哀的现实
悲哀的现实 2020-12-07 17:44

Some background:

I have iOS application with a target configured to run unitTests. And I am running build automation tool jenkins on my MacBook whic

6条回答
  •  孤城傲影
    2020-12-07 17:58

    Workaround:

    App will still launch but you can #if to define what you don't want to run.

    Approach:

    1. Create a custom build configuration called Test by duplicating Debug (Project > Info > create new configuration)
    2. In Build Settings > Active Compilation Conditions for Test add TESTING
    3. Edit Scheme > Info > Build Configuration, set build configuration as Test
    4. Use #if !TESTING #endif around the code you don't want to execute when testing.

    Frameworks:

    If you have embedded frameworks, create the same build configuration in the framework, so that the framework binary is properly linked.

提交回复
热议问题