Problem:
Test plans don’t execute with tuist test --test-plan PrimaryTests.xctestplan MyApp-Main, but work fine in Xcode. Other schemes without test plans work normally with tuist test.
Command:
bash
tuist test --test-plan PrimaryTests.xctestplan MyApp-Main
Configuration:
swift
.scheme(
name: "MyApp-Main",
testAction: .testAction(
targets: [],
testPlans: ["Testplan/PrimaryTests.xctestplan"]
)
)
Key Facts:
-
Test plans work in Xcode
-
tuist test MyApp-Other works (no test plans)
-
tuist test --test-plan PrimaryTests.xctestplan MyApp-Main doesn’t execute tests
-
Test plans are only in MyApp-Main scheme
Question:
Why do test plans prevent tuist test from executing tests when they work fine in Xcode? Is there a specific requirement for test plans with Tuist?
Note: Testplan already have the targets specofied correctly.
Hey @muneerkk66 
tuist test should work seamlessly with test plans – sorry to hear it’s not the case for you. We’ll need a bit more information to debug this, ideally a full reproducer.
If a reproducer is too complex, I’d also suggest checking:
- This fixture that showcases a project with a test plan
- run the
tuist test command with —generate-only – do you see the test plan in the generated project?
@marekfort
Thanks for your reply.
Yes, I can confirm that the test plan is generated correctly when using tuist test --generate-only.
A couple more details that might help:
I have multiple projects inside the workspace, and each test entry in the test plan looks like this:
{
"target": {
"containerPath": "container:Authentication/Authentication.xcodeproj",
"identifier": "XXXXXXX-XXXXXXXXX-XXXXXX",
"name": "AuthenticationTests"
}
}
Could the containerPath pointing at project-local .xcodeproj files have any impact when Tuist executes the test plan?
Xcode handles these container paths fine, but I’m wondering if Tuist expects test plan targets to use a different or more “global” path format.
Let me know if this might be related or if you want a minimal reproducer.
I’d probably try to:
- put the test plan in the root
- ensure the
containerPath is pointing to the .xcodeproj relative to the root
Now, we should definitely handle your scenario more gracefully, but this could help nail down the issue.
Alternatively, I’d try to change the containerPath of the test plan to be relative to the test plan location when the test plan is in the same directory as the project, like we have in this fixture.
A reproducer would still be amazing. You might be able to reproduce your setup and the issue with one of the fixtures I linked – reproducers help a ton in fixing issues like this.
Also, just double checking – what Tuist version are you on? If not the latest, I’d suggest to update first.
Thanks again @marekfort.
I tried setting up a minimal reproducer using the same multi-project structure, but I wasn’t able to reproduce the issue. In the sample setup, Tuist successfully located and executed the test plan — even when I matched the folder hierarchy and placed the test plan at the workspace root.
In our actual project, though, Tuist still doesn’t seem able to resolve the test plan paths during tuist test, even after moving the test plan to the root and adjusting the containerPath values. Xcode continues to pick it up without any issues.
One more detail that might help:
If I run the tests directly using an xcodebuild command and pass the exact same test plan, it works fine. So the test plan itself is valid, and the issue appears to be tied specifically to how Tuist interprets our project layout or resolves paths inside the test plan.
I’ll continue trying to isolate the issue, and if I manage to extract a proper reproducible example, I’ll share it.
Thanks again for the guidance!
app_workspace_with_test_plan.zip (88.5 KB)
Here is my sample project.
@marekfort Any updates here ?
@muneerkk66 thanks for the reproducible project. What are the steps that you run there to make it fail?
@pepicrft Thank you for your response. Please find the details below.
tuist test MainApp-Scheme --test-plan UnitTests
Generating project for testing
Loading and constructing the graph
It might take a while if the cache is empty
Using cache binaries for the following targets:
Generating workspace MainApp.xcworkspace
Generating project App1
Generating project App2
The scheme MainApp-Scheme’s test action has no test plans to run, finishing early.
Thanks @muneerkk66. I checked your project, and it turns out you have a typo in the path to the test plan. It should be Testplan/UnitTests.xctestplan and not TestPlans/UnitTests.xctestplan. Once you change that, you’ll notice that if you run tuist generate, the scheme MainApp-Scheme will contain the test plan.
You’ll also have to add build targets to the scheme, otherwise there’s nothing to build. Note that the targets that need to build are not infered from your test plan, hence why you need to be explicit about it.