Consider this sample project: https://github.com/stremsdoerfer/TestPlan. This is just a Hello World that has two test plans: TestPlanUnit
that only runs unit tests and TestPlanUI
that only run UI tests.
Running the command below with Xcode 14.3, I’d expect TestPlanUI
to be run, but instead only TestPlanUnit
is run which is the default.
xcodebuild -scheme TestPlan -destination 'platform=iOS Simulator,id=<sim_id>' -testPlan TestPlanUI test-without-building
It works fine with Xcode 14.2.
Using test
instead of test-without-building
also works fine.
Any thoughts?
3
Answers
Having the same problem and reported an issue to Apple. The
testPlan
parameter seems to be ignored whentest-without-building
is passed.I also reported
testPlan ignored when using xcodebuild test-without-building
to Apple.Apple responded with:
Potential fix identified - For a future OS update
.Not a solution, but a potential work-around until Apple fixes it. If you make a copy of your Scheme and then set the default TestPlan for that Scheme to be the test you want to run, test-without-building will pay attention to the default test in the Scheme.
I’ve tested with
fastlane
and directly usingxcodebuild
and both worked this way. I don’t love it, especially because my schemes are fairly complex. However, I did have success getting my tests to run.Make sure your Run variants are all built. I ran into a problem where I’d copied my schemes a while back and one scheme diverged by the Run / Diagnostics settings for the Runtime Sanitization for a single TestPlan. As such, that scheme wanted a binary in the
Variant-NoSanitizers
when I ran my tests in CI with sanitization turned off.