I'm having an issue with running Swift Package tests through a test plan on Bitrise. While everything works fine locally, Bitrise fails with "There are no test bundles available to test."
I have created an Xcode project that consumes many local packages. These packages have tests that I want to run on Bitrise. I've created a test plan called CI.xctestplan and added it to the scheme Debug (it shouldn't be called Debug, but historical reasons).
To be able to add my package tests to the test plan, I've dragged them from the Package Dependencies into the main project in the Project Navigator. This allowed me to "see" and add the tests inside of these Packages in the test plan, otherwise I couldn't. Whenever I add these packages this way, I need to restart Xcode before they become expandable, available as a test target, and disappear from the Package Dependencies list.
When I run these tests from Bitrise, using "Xcode Test for iOS 6.0.0", I get this error: "CopyFailed to build project MyApp with scheme Debug.: There are no test bundles available to test."
This error occurs consistently on Bitrise, even when running the same branch multiple times, while no other builds have been running in between.
I suspected this might be a caching issue (similar to how Xcode needs to be restarted locally), so I disabled the restore-spm-cache step in Bitrise, but I'm still seeing the same issue.
I can test one individual package successfully, but I have many packages that I need to test and I would like to use the test plan to ensure it's easy to run the same tests both locally and on CI.
The issue seems similar to what happens locally when I switch branches to a branch that does not have these packages added the same way and back. At that point, the packages are not expandable and appear in the Package Dependencies list again, until I restart Xcode.
It appears that Xcode needs some kind of refresh/restart on the CI, but I'm not sure how to accomplish this when only running command-line tests. Has anyone encountered this issue or know how to fix this problem with Bitrise and Swift Package tests?
I finally figured it out:
When you drag in the packages from the Package Dependencies, they were adding themselves with an absolute path. Obviously my local path does not exist on the CI.
The thing that threw me off is that everything else was working, because you still have the Packages, they're just not in that sort of local scope you get from dragging them in. And if that's the case, the tests cannot be seen anymore by your Test Plan.