-
-
Couldn't load subscription status.
- Fork 1.6k
Migrating from TestNG to JUnit Jupiter
Sam Brannen edited this page Feb 7, 2023
·
9 revisions
- Test classes should be annotated with
@TestInstance(Lifecycle.PER_CLASS)to align with TestNG semantics. -
@BeforeClass/@AfterClassmethods should be annotated with@BeforeAll/@AfterAll. - Tests using data providers should be converted to parameterized tests (
@ParameterizedTest). - The order of the
expectedandactualarguments to assertion methods such asassertEquals(...)need to be swapped so that theexpectedresult precedes theactualresult. - Usage of
expectThrows(...)should be changed toassertThrows(...). - Tests that threw
SkipExceptionshould make use of the theAssumptionsAPI,