Hive Hive
Sign in

Tuist Test: targets not found with test-targets arguments

GitHub issue · Open

Metadata
Source
tuist/tuist #6942
Updated
Jun 11, 2026
Domains
CLI
Details

What happened?

Duplicated from this discussion: https://community.tuist.io/t/stop-using-focus-when-testing/136

I have a script that allows generating XCTestPlan in which all unit-test targets that are in the workspace are, using gem xcodeproj.

I am thinking of abandoning the testPlan generation and passing the entire list via the --test-targets flag, but I encountered unexpected behavior:

At the first launch, everything works correctly. At the second launch, focusing occurs, excluding test targets on which tests were previously launched. This results in an error:

The following targets were not found: A, B, C

Deleting the ~/.cache/tuist/SelectiveTests folder fixes the error, but deletes the cache 😕

This behavior seems contradictory and requires (in the current situation) a premature error: –test-targets cannot be used together with –selective-testing

How do we reproduce it?

Call twice follow command:

tuist test --platform iOS --test-targets A B C --selective-testing

Error log

The following targets were not found: A, B, C

macOS version

Tuist version

4.31.0

Xcode version

14.3

Flights

Investigate, reproduce, or fix this item in an isolated repository. Each Flight preserves its outcome and agent session.

New Flights are paused Configure model inference, GitHub, and a sandbox provider to start another Flight. Existing results remain available below.
No Flights yet

Start a Flight and preserve its objective, outcome, and session here.

Comments
A
amarcadet Jan 29, 2025

I am currently facing the same issue.

Using Tuist 4.40 I can reproduce the same behavior.

During the first run using tuist test --test-targets XXXTests the tests are correctly executed.

During the second run using the same command and parameters I get the error The following targets were not found: XXXTests. Please, make sure they exist.

If I perform tuist clean selectiveTests and then run the tests, it works fine but at the cost of losing the cache.

P
pepicrft Jan 30, 2025

I’ll look into it ;)

R
robmaceachern May 28, 2025

We’re also suffering from this (and it was quite confusing when experimenting with --test-targets).