Converts TestNG test annotations and assertions to Junit 5.
Inspired by the Migrate JUnit 4 @Test annotations to JUnit 5 recipe
This repository is under heavy development. Refer to the project kanban board for ongoing updates on the road to feature completeness. Should you notice a blind spot regarding TestNG features that should be included in a project migration, or if you have idea for a particular implementation, your contributions are welcome!
See below tables for a brief summary of the implementation progress.
Annotation | on Class |
on Methods |
---|---|---|
@Test |
:heavy_check_mark: | :heavy_check_mark: |
@Test(description = "%s") |
:hammer: #23 | :heavy_check_mark: |
@Test(enabled = false) |
:hammer: #39 | :heavy_check_mark: |
@Test(expectedExceptions = Exception.class) |
:hammer: #20 | :heavy_check_mark: |
@Test(expectedExceptionsMessageRegExp = "%s") |
:hammer: #21 | :heavy_check_mark: |
@Test(groups = "%s") |
:hammer: #27 | :heavy_check_mark: |
@Test(timeOut = "%s") |
:hammer: #25 | :heavy_check_mark: |
@DataProvider |
:hammer: #6 | :hammer: #38 |
@Ignore |
:hammer: #15 | :hammer: #15 |
@Test(enabled = CONSTANT_EXPRESSION) |
:thinking: #35 | :thinking: #35 |
@Factory |
:thinking: #8 | :thinking: #8 |
@Test(priority, threadPoolSize) et al. |
:grey_question: #5 | :grey_question: #5 |
Feature | on Class |
---|---|
Tests in inner classes | :heavy_check_mark: #30 |
Assertions | :hammer: #3 |
Lifecycle annotations | :hammer: #7 |
Per class instantiation lifecycle | :hammer: #14 |
SkipException (→ assumption) |
:hammer: #32 |
Dependency migration | :hammer:#29 |
Interceptor interfaces | :thinking: #10 | #11 |
Listener interfaces | :thinking: #12 | #13 |
if you're an SDKMAN!-Andy, simply run sdk env
from the project directory
otherwise ensure:
are provided on your system.
From the project directory, run one of the following:
```bash mvn install -DskipTests ```
```bash ./gradlew publishToMavenLocal # or ./gradlew pTML # or mvn install ```
This will publish to your local maven repository, typically under ~/.m2/repository
.
In the `pom.xml` of a different project you wish to run the recipe on,
make it a plugin dependency of rewrite-maven-plugin:
```xml
Unlike Maven, Gradle must be explicitly configured to resolve dependencies from Maven local. In the root project of a gradle build that you wish to run this recipe on, make it a dependency of the `rewrite` configuration: ```groovy plugins { id("java") id("org.openrewrite.rewrite") version("latest.release") } repositories { mavenLocal() mavenCentral() } dependencies { rewrite("com.yourorg:rewrite-recipe-starter:latest.integration") } rewrite { activeRecipe("com.yourorg.NoGuavaListsNewArrayList") } ``` Now run the recipe via `gradlew rewriteRun`.