This project assembles Open Rewrite Recipes to migrate unit tests suites from TestNG to JUnit Jupiter.
Note
For the authors it is very important to state: Using TestNG is perfectly fine! If you decide to migrate for what ever reasons, these recipes are your way to go.
You can get help to writing Open Rewrite Recipes you can join the Open Rewrite Slack .
To get help regarding TestNG or JUnit Jupiter see the project pages.
If you have problems regarding the recipes within this artifact feel free to contact me in the testing channel at the jvm-german Slack or directly via @[email protected] on Mastodon.
For further information see the Open Rewrite docs section Authoring Recipes.
Open Rewrite recipe artifacts are usually build with gradle or maven. This repository uses maven, the build is 100% taken from the moderneinc/rewrite-recipe-starter and depends on Java 17.
The Recipes in this artifact follow a few main ideas, to kickstart other developer they are shortly describe here.
The TestNG annotation @org.testng.annotations.Test
is responsible to configure the test.
Within JUnit Jupiter all configurations are made thought dedicated annotations.
This implies that all configuration have to be migrated before the Test annotations can be exchanged.
To respect this
the MigrateTestAnnotation
recipe only migrates Test annotations without any parametes and the recipes that migrate the configurations (
f.e. MigrateEnabledArgument)
have to remove the configuration after migration
The semantics of TestNG and JUnit Jupiter does not alight 100% straight forward. There is a list maintained by the JUnit Team addressing the migration from TestNG to JUnit Jupiter . In any case these summary should be consulted first.
If you find bugs or missing migrations feel free to file an issue or submit a pull request.