Repository navigation
Group tests into per-file suites, not one import-path bucket - #1
Merged
Merged
Conversation
The flakiness.io maintainer reported that "your tests belong to the top-level
'github.com/.../tests' suite" — because we emitted one type:"file" suite per Go
PACKAGE, titled by the import path and with no location. The spec defines
type:"file" as "Suite representing a test file" (with a file location, (0,0)),
so every test in a package collapsed under one import-path bucket instead of
being grouped by their actual source file the way Playwright/JUnit reports are.
Now top-level suites are per source FILE: each test's top-level function is
located via go/ast, tests sharing a file are grouped under a file suite titled
by the git-relative path with location {file,0,0}. Tests whose file can't be
resolved fall back to a package-titled file suite so nothing is lost.
Added fixture file (testdata/example/extra_test.go) + unit tests for multi-file
grouping and the package fallback; updated the e2e test to walk all file
suites. features.md #5 updated.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Problem
The flakiness.io maintainer reported:
We emitted one
type:"file"suite per Go package, titled by the import path and with no location. But the spec definestype:"file"as "Suite representing a test file" (with a file location; file suites use(0,0)). So every test in a package collapsed under one long import-path bucket, instead of being grouped by their actual source file the way the Playwright / JUnit reporters group.Fix
Top-level suites are now per source file:
TestXxx/Example/Benchmark/Fuzz) is located viago/ast.filesuite titled by the git-relative path, withlocation:{file, 0, 0}.filesuite, so nothing is lost when source resolution is unavailable.Subtest nesting (
TestX/a/b→ nestedsuitenodes) and parent-test-own-failure preservation are unchanged.Before / After
Same fixture (
testdata/example/sample_test.go):Before — one import-path bucket, no location:
After — a
filesuite titled by the source file, with a location:And tests split across files now produce separate file suites (verified with an added
extra_test.gofixture):Tests
TestConvert_FileSuites— two top-level tests in different files → twofilesuites, each titled by + located at its path, location(0,0).TestConvert_FileSuiteFallbackToPackage— no locator → single package-titledfilesuite (nothing lost).sample_test.gofile suite carries a location.features.md#5 updated.Full suite green (
go test -race ./...),go vetclean.Flakiness.io viewer — before / after
The same fixture (
testdata/example), served to the real Flakiness.io report viewer viaflakiness show. Only the test grouping differs.Before (
main) — every test sits under one import-path suite,example.test/sample › …:After (this PR) — tests are grouped by their source file,
sample_test.go › …(and a separateextra_test.gosuite), each with a file location: