Good news Everyone!™ The number one testing framework in the Java ecosystem has moved a major step forward: JUnit 5 final is available since yesterday and brings lots of major improvements for the way you implement your test cases!
And of course, TestEE.fi offers JUnit 5 integration since day one! And of course, it’s just as easy to functional test your Java-EE applications with TestEE.fi as it was with JUnit 4.
Dependency management
Just make sure you’re using the testeefi-junit5-all dependency instead of the JUnit 4 version in your Maven dependencies:
In Gradle your dependencies would look like this:
Writing a TestEE.fi extended test with JUnit 5
The JUnit 4 integration leveraged the concept of Runners where you could specify a custom Runner implementation using the @RunWith annotation. JUnit 5 abandons the concept of Runners and instead offers the option to add multiple Extensions to your test class using the @ExtendWith annotation.
So, remembering the minimal introductory example from Part 1, we can accomplish the same now by simply using the TestEE.fi extension:
Conclusion
Using TestEE.fi with JUnit 5 is just as easy as it was with JUnit 4. Whether you are migrating an existing project to the new JUnit version (which does not come for free!) or setup a new Jave-EE project using the latest iteration of Java’s most famous test execution framework, TestEE.fi is ready it.
A working example project an be found here.
If you want to know more about advanced testing with TestEE.fi, be sure to check out the other posts of this series to get you up to speed quickly:
- Part 1: Introduction
- Part 2: Mocking with Mockito and EasyMock
- Part 3: JDBC and JPA
- Part 4: Cucumber JVM
- Part 5: JAX-RS and REST resources
- Part 7: Static resources and Selenium (coming soon)
- Part 8: JMS and MDBs (coming soon)