Post

Replies

Boosts

Views

Activity

Problem using test plans with local Swift Packages
I'm using Xcode 11.5.I'm using test plans.I have an app that uses several local Swift Packages.When I test the app, I'd like to run the tests for the packages.In the current scheme I've tried putting a checkmark for "SomePackageTests" under the Test column in the Build action.The test plan, "SomeTestPlan", seems to show up as its own target in the Build action. It has a disclosure icon to its left. When I expand, I see the test targets for the app and for all local packages. The expanded test targets don't have their own checkboxes. I've also tried putting a checkmark for "SomeTestPlan" itself under the Test column in the Build action.When I edit the test plan, I see the test targets for the app and for all local packages. I've tried enabling the package tests there too.The app tests (unit and UI) build and run successfully. For example, they show up in the test navigator. I can right-click on them, select "Run", and they build and run successfully.The package tests are also listed in the test navigator. They build successfully—I see a "Build Succeeded" message pop up—but they don't run successfully. The error looks like this: 2020-05-26 11:03:33.947959-0400 xctest[55965:34366669] Failed to create a bundle instance representing '/Users/someuser/Library/Developer/Xcode/DerivedData/SomeApp-eecekbbecwouyeagzirvwewncpem/Build/Products/Alpha-Debug-iphonesimulator/SomePackageTests.xctest'. Check that the bundle exists on disk. Program ended with exit code: 1(Note that "Alpha-Debug" is the name of both a build configuration and a test plan. I assume the above is a reference to the test plan, but I could be wrong.)I *think* the problem is that Xcode is looking in the wrong place—but only for the package tests, not the app tests.It's correct that there's no directory at that location. There is, however, a directory by that name in this location: /Users/someuser/Library/Developer/Xcode/DerivedData/SomeApp-eecekbbecwouyeagzirvwewncpem/Build/Products/Variant-UBSan/Alpha-Debug-iphonesimulator/SomePackageTests.xctest/Here's the key difference.The first path has ".../Products/Alpha-Debug...".The second path has ".../Products/Variant-UBSan/Alpha-Debug..."."UBSan" is the name of my default (and one-and-only) test configuration in the test plan.So: it seems like building builds to a test configuration dir, but running looks in a non-test configuration dir. At least for packages.Is this an Xcode bug, or did I misunderstand something?Again, the goal is to run all of my package tests when I test my app.PS I *think* this was working before I switched to test plans, but I'm not absolutely certain.
3
0
4.8k
May ’20