After converting our tests in one of our schemes "Scheme" to test plans using the "Convert to use Test Plans" function in Xcode 13.4. We cannot run the tests using xcodebuild due to the following error:
xcodebuild: error: Failed to build project Scheme with scheme Scheme.
Reason: Tests cannot be run because the test plan “Scheme” could not be read.
Recovery suggestion: Confirm that the file exists and is valid and try again.
Setting the test plan name explicilty using the -testPlan
parameter results in the same error message.
The scheme configuration exists in the configured location and can be displayed by Xcode.
This seems to happen when the test plan has the same name as your scheme. Changing the name of the test plan to SchemeTestplan has solved the issue.
Curiously this was the default name chosen by Xcode.