detect custom Gradle test source sets in test import options#1660
Open
Develop-KIM wants to merge 1 commit into
Open
detect custom Gradle test source sets in test import options#1660Develop-KIM wants to merge 1 commit into
Develop-KIM wants to merge 1 commit into
Conversation
`ImportOption.DoNotIncludeTests` and `OnlyIncludeTests` relied on `GRADLE_TEST_PATTERN` matching only the standard `test` source set (`.../build/classes/[lang]/test/...`). Classes compiled from custom Gradle test source sets such as `integrationTest`, `functionalTest` or `e2eTest` were treated as production code, so they were not excluded by `DoNotIncludeTests` (and not included by `OnlyIncludeTests`). Broaden the pattern to also match source set folders following the Gradle `...Test` naming convention (plus the plural `tests`), while still ignoring `main` and the separately handled `testFixtures` folder, and without matching unrelated names such as `latest`. Resolves: TNG#1578 Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com> Signed-off-by: Develop-KIM <kimdonghwan913@gmail.com>
1039fdf to
8f4183c
Compare
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.
What & why
Fixes #1578.
ImportOption.DoNotIncludeTestsandOnlyIncludeTestsdid not recognize tests in custom Gradle source sets (e.g.integrationTest,functionalTest,e2eTest), becauseGRADLE_TEST_PATTERNonly matched the standard lowercasetestfolder. Custom test classes were therefore treated as production code — not excluded byDoNotIncludeTests, and not included byOnlyIncludeTests.Change
GRADLE_TEST_PATTERNfrom.*/build/classes/([^/]+/)?test/.*to.*/build/classes/([^/]+/)?(test|[^/]+Test)s?/.*, so it also matches source-set output folders that follow the Gradle...Testnaming convention (plus the pluraltests).Testboundary keepsmainexcluded, preserves the separately handledtestFixturesfolder (DoNotIncludeGradleTestFixtures), and avoids false positives such aslatest.DoNotIncludeTestsJavadoc accordingly.ImportOptionsTestdata points forintegrationTest,functionalTest,e2eTest,tests, and atestFixtures→ main regression guard.Verification
./gradlew :archunit:test --tests "*ImportOptionsTest"→ 92 tests, 0 failures (the new source-set folders resolve as test locations;testFixtures/mainstay non-test).:archunit:spotlessCheckpasses.This change was prepared with AI assistance (Claude); I have reviewed and verified it and take responsibility for the contribution.