Skip to content

Display number of new tests for subset and New column for inspect commands - #1355

Open
takanabe wants to merge 1 commit into
mainfrom
subset-transparancy
Open

Display number of new tests for subset and New column for inspect commands#1355
takanabe wants to merge 1 commit into
mainfrom
subset-transparancy

Conversation

@takanabe

@takanabe takanabe commented Jul 29, 2026

Copy link
Copy Markdown
Contributor

Background

We want to let the CLI users to know if tests are new and how many new tests are introduced for given subsets. This PR support the feature for subset and inspect commands.

Expected output

Subset command output with this change

We expect an output like below.

$ find ./tests/**/*.py | smart-tests subset file --session @session.txt --target 20% > subset.txt
Smart Tests created subset 410 for build  (test session 802) in workspace konboi/pts-v2

|           |   Candidates |   Estimated duration (%) |   Estimated duration (min) |
|-----------|--------------|--------------------------|----------------------------|
| Subset (New Tests) |           18 (3) |                    20.00 |          0.00 |
| Remainder          |               72 |                    80.00 |          0.00 |
|                    |                  |                          |               |
| Total              |               90 |                   100.00 |          0.00 |

Run `smart-tests inspect subset --subset-id 410` to view full subset details

(3) new test count in Subset (New Tests) | 18 (3) comes from summary.subset.newTestCount, which this branch added to JSSubsetSummary. The CLI reads that field to render the parenthetical.

Inspect command output with this change

We expect an output like below.

| # | Test                                      | In Subset | Density  | Duration| New    |
|---|-------------------------------------------|-----------|----------|---------|--------|
| 1 | src/test/java/com/example/FooTest.java    |   ✔       | ...      | 0.000s  | Yes    |
| 2 | src/test/java/com/example/BarTest.java    |   ✔       | ...      | 0.000s  | Yes    |
| 3 | src/test/java/com/example/KnownTest.java  |   ✔       | ...      | 1.230s  | No     |

The New column (Yes/No per test) is driven by numNewTests on each OptimizationResult in the inspect response. SubsetDetailService returns the full OptimizationResult objects including numNewTests, so the CLI can check numNewTests > 0 to render Yes/No.

local executions

Subset

Inspect

uv run smart-tests inspect subset --subset-id 7
|   Order | Test Path                                              | In Subset   |     Density | Duration   | New   |
|---------|--------------------------------------------------------|-------------|-------------|------------|-------|
|       1 | file=tests/commands/test_api_error.py                  | ✔           | 1800000.000 | 0.001s     | Yes   |
|       2 | file=tests/test_runners/test_googletest.py             | ✔           | 1800000.000 | 0.001s     | Yes   |
|       3 | file=tests/commands/record/__init__.py                 | ✔           | 1800000.000 | 0.001s     | Yes   |
|       4 | file=tests/test_runners/test_maven.py                  | ✔           | 1800000.000 | 0.001s     | Yes   |
|       5 | file=tests/commands/record/test_tests.py               | ✔           | 1800000.000 | 0.001s     | Yes   |
|       6 | file=tests/commands/test_verify.py                     | ✔           | 1800000.000 | 0.001s     | Yes   |

@takanabe
takanabe requested a review from Konboi July 29, 2026 21:40
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant