Skip to content

Run the Cucumber JUnit Platform suite migration from JUnit4to5Migration - #1178

Merged
timtebeek merged 2 commits into
mainfrom
tim/recipes-issues-next-steps
Oct 8, 2026
Merged

timtebeek merged 2 commits into
mainfrom
tim/recipes-issues-next-steps

Conversation

@timtebeek

@timtebeek timtebeek commented Oct 8, 2026 •

Copy link
Copy Markdown
Member

JUnit4to5Migration removed junit:junit but left @RunWith(Cucumber.class) in place, so acceptance tests run by the Cucumber JUnit 4 runner failed to compile with package org.junit.runner does not exist. The migration now runs rewrite-cucumber-jvm's CucumberToJunitPlatformSuite (openrewrite/rewrite-cucumber-jvm#67), which converts that runner and its @CucumberOptions to a JUnit Platform @Suite, and adds rewrite-cucumber-jvm as a runtimeOnly dependency, as is already done for error-prone-contrib. It runs right after RemoveObsoleteRunners, before UpdateBeforeAfterAnnotations, as it turns a runner's @BeforeClass and @AfterClass into @BeforeSuite and @AfterSuite. A new end-to-end test in JUnit5MigrationTest covers a runner with class-level setup and its pom, for which cucumber-junit is added to the test type tables, and recipes.csv is regenerated with the new recipe counts.

…ion`

`JUnit4to5Migration` removed `junit:junit` but left `@RunWith(Cucumber.class)` in
place, so acceptance tests run by the Cucumber JUnit 4 runner no longer compiled.
rewrite-cucumber-jvm's `CucumberToJunitPlatformSuite` now converts that runner to a
JUnit Platform `@Suite` (openrewrite/rewrite-cucumber-jvm#67), so the migration runs
it, with rewrite-cucumber-jvm as a runtime dependency.
… migrated

`CucumberToJunitPlatformSuite` now also turns the class-level setup and teardown of
a runner into `@BeforeSuite` and `@AfterSuite`, so it runs ahead of
`UpdateBeforeAfterAnnotations`, converting the runner from its JUnit 4 annotations
rather than from the `@BeforeAll` that recipe would leave.
@timtebeek
timtebeek merged commit eaabc1d into main Oct 8, 2026
1 check passed
@timtebeek
timtebeek deleted the tim/recipes-issues-next-steps branch October 8, 2026 16:39
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

Archived in project

Development

Successfully merging this pull request may close these issues.

1 participant