How do you reference testPlans using xcodegen?

732 views Asked by At

I'm not managing to reference the testPlans created manually in the xcworkspace file after running xcodegen.

It always says:

"The flag -testPlan cannot be used since the scheme does not use test plans."

The documentation on GitHub doesn't help much, as it's not clear where to add these lines when the project also uses schemeTemplates and targetTemplates.

Has anyone managed to make testPlans work together with multiple test targets and multiple schemes, using xcodegen?

I tried adding the testPlan file in the project.yml in the

schemeTemplates -> MyAppSchemeTemplate -> test -> testPlans -> path -> UnitTestsFeatureAOnlyTestPlan.xctestplan

And I tried pretty much everything possible within the xcodegen project.yml file, but nothing matched the project.xcscheme that gets generated when doing the testPlan creation from Xcode (while doing a scheme conversion to testPlan)

1

There are 1 answers

0
bvarga On

You do not need to add to the schemeTemplates. You can use the following syntax:

schemes:
  appTests:
    build:
      targets:
        appSnapshotTests: none
    test:
      testPlans:
        - path: appTests.xctestplan
          defaultPlan: true