Skip to content

Migrate from TestFactory to ParameterizedTest - #2188

Draft
Goooler wants to merge 11 commits into
mainfrom
g/20260813/ParameterizedTest
Draft

Migrate from TestFactory to ParameterizedTest#2188
Goooler wants to merge 11 commits into
mainfrom
g/20260813/ParameterizedTest

Conversation

@Goooler

@Goooler Goooler commented Aug 13, 2026

Copy link
Copy Markdown
Member

No description provided.

@Goooler
Goooler force-pushed the g/20260813/ParameterizedTest branch from a9ebba9 to 74a5556 Compare August 13, 2026 11:31
@Goooler
Goooler requested a lite review from Copilot August 13, 2026 12:59
@Goooler Goooler changed the title Migrate from MethodSource to ParameterizedTest Migrate from TestFactory to ParameterizedTest Aug 13, 2026

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

This PR refactors the documentation snippet tests to use a JUnit 5 @ParameterizedTest with a @MethodSource instead of generating DynamicTests, while simplifying the snippet execution model and improving failure diagnostics.

Changes:

  • Replace the DynamicTest factory with @ParameterizedTest fed by a snippets() method source.
  • Refactor SnippetExecutable from a JUnit Executable sealed class into a sealed interface with an explicit execute(projectRoot: Path) API.
  • Simplify code-snippet discovery into a DslLang.extractCodeSnippets() extension and enhance exception messages with source location + build output.

Reviewed changes

Copilot reviewed 5 out of 5 changed files in this pull request and generated no comments.

Show a summary per file
File Description
src/documentTest/kotlin/com/github/jengelman/gradle/plugins/shadow/snippet/SnippetExecutable.kt Refactors the snippet executor API and centralizes richer error reporting within execute(Path).
src/documentTest/kotlin/com/github/jengelman/gradle/plugins/shadow/snippet/KotlinBuildExecutable.kt Updates Kotlin DSL snippet executor to implement the new SnippetExecutable interface shape.
src/documentTest/kotlin/com/github/jengelman/gradle/plugins/shadow/snippet/GroovyBuildExecutable.kt Updates Groovy DSL snippet executor to implement the new SnippetExecutable interface shape.
src/documentTest/kotlin/com/github/jengelman/gradle/plugins/shadow/snippet/CodeSnippetExtractor.kt Reworks snippet extraction into a DslLang extension that produces SnippetExecutables with source metadata.
src/documentTest/kotlin/com/github/jengelman/gradle/plugins/shadow/DocCodeSnippetTest.kt Migrates to @ParameterizedTest + @MethodSource, wiring per-invocation temp directories and named arguments.

💡 Add a code-review agent skill or configure MCP servers for context-aware, tailored reviews. Learn more in the docs.

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