Skip to content

Support subtest case in go-test profile#1045

Merged
Konboi merged 2 commits into
mainfrom
go-test-subtest
Jun 17, 2025
Merged

Support subtest case in go-test profile#1045
Konboi merged 2 commits into
mainfrom
go-test-subtest

Conversation

@Konboi

@Konboi Konboi commented Jun 16, 2025

Copy link
Copy Markdown
Contributor

What

In Go, we can define subtests like the example below.
However, in the test report, they are shown as a single test case using the format: test function name / subtest name.
But when using the go test -list command, which is used for subsetting, only the test function names are output—subtest names are not included.
So we need to update the Go test profile to support subtests.

e.g) subtest example

t.Run(tt.title, func(t *testing.T) {...}

go test -llist result

go test -list="Test|Example" ./...
TestExample1
TestExample2
TestExample3
TestExample4
TestExample5
ok      github.com/launchableinc/examples/go    0.287s
TestGreeting
ExampleGreeting
ok      github.com/launchableinc/examples/go/example    0.475s

report example

        <testcase name="TestExample5/Test_case_2_(fail_case)" classname="github.com/launchableinc/examples/go" time="0.000">
            <failure message="Failed"><![CDATA[    example3_test.go:38: expected 8, got 7]]></failure>
        </testcase>

Created data used by this PR: cloudbees-oss/smart-tests-integration-examples#89

@sonarqubecloud

Copy link
Copy Markdown

@Konboi Konboi requested review from ninjinkun and ono-max June 16, 2025 08:24
@Konboi

Konboi commented Jun 17, 2025

Copy link
Copy Markdown
Contributor Author

@ninjinkun or @ono-max Could you approve it? You don't have to review carefully

@Konboi Konboi merged commit efe139b into main Jun 17, 2025
15 checks passed
@Konboi Konboi deleted the go-test-subtest branch June 17, 2025 01:11
@github-actions github-actions Bot mentioned this pull request Jun 11, 2025
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.

2 participants