Why convert existing tests from JUnit4 to Junit5?

146 Views Asked by At

What are the advantages to making the non-trivial effort (even with automated tools) to convert a large number of existing JUnit4 tests to JUnit5? All the sources I see show advantages for writing new tests in JUnit5, but I don't see anything that would let me justify the effort to convert our existing JUnit4 tests rather than continuing to have JUnit4 and JUnit5 running side-by-side.

1

There are 1 best solutions below

0
johanneslink On BEST ANSWER

As long as your JUnit4 tests do what you want and can be expressed as concisely as necessary I see no pressing reason to migrate existing tests.

In the long run you might want to get rid of the old tests in order to

  • have fewer dependencies
  • need less knowledge about differences of behaviour
  • prevent duplicate effort for JUnit rules vs extensions or other home-made test support code

That said the JUnit platform is explicitly designed to allow JUnit 4 and 5 and other test engines present in the same project.