원클릭으로
migrate-junit-source-to-tabletest
// Convert JUnit 5 @MethodSource/@CsvSource/@ValueSource parameterized tests to @TableTest (JDK8)
// Convert JUnit 5 @MethodSource/@CsvSource/@ValueSource parameterized tests to @TableTest (JDK8)
Converts Spock/Groovy test files in a Gradle module to equivalent JUnit 5 Java tests. Use when asked to "migrate groovy", "convert groovy to java", "g2j", or when a module has .groovy test files that need to be replaced with .java equivalents.
Write a new library instrumentation end-to-end. Use when the user ask to add a new APM integration or a library instrumentation.
Analyze branch changes for technical debt, code duplication, and unnecessary complexity
| name | migrate-junit-source-to-tabletest |
| description | Convert JUnit 5 @MethodSource/@CsvSource/@ValueSource parameterized tests to @TableTest (JDK8) |
Goal: Migrate JUnit 5 parameterized tests using @MethodSource/@CsvSource/@ValueSource to @TableTest with minimal churn and passing tests.
Process (do in this order):
Import: import org.tabletest.junit.TableTest;
JDK 8 rules:
@TableTest({
"a | b",
"1 | 2"
})
Table formatting rules (mandatory):
{a, b, c}) instead of matrix-style repetition when only one dimension varies across otherwise-identical rows.Conversions: A) @CsvSource
B) @ValueSource
@ValueSource (and @NullSource when null cases are needed).C) @MethodSource (convert only if values are representable as strings)
@TableTest and @MethodSource may be combined on the same @ParameterizedTest when most cases are tabular but a few cases require programmatic setup.@TableTest, and put only non-tabular/complex cases in @MethodSource.@TableTest is not viable for the test at all, use @MethodSource only.@MethodSource, name the arguments method <testMethodName>Arguments (camelCase, e.g. testMethodArguments) and return Stream<Arguments> using Stream.of(...) and arguments(...) with static import.D) @TypeConverter
@TypeConverter for symbolic constants used by migrated table rows (e.g. Long.MAX_VALUE, DDSpanId.MAX).utils/test-utils) when reuse across modules is likely.Scenario handling:
Cleanup:
Mixed eligibility:
@TableTest + @MethodSource on one @ParameterizedTest when only some cases are complex.Do NOT convert when:
Test command (exact): ./gradlew :path:to:module:test --rerun-tasks 2>&1 | tail -20