Skip to content

Tag: junit5

Are test suites considered deprecated in JUnit5?

I am trying to create test suites with JUnit5. After some research I was not able to conclude whether it is a supported feature or not. The official user guide only mentions suites with regard to backwards compatibility to JUnit 4. This is how it was done back in JUnit 4: Does this mean, that Test Suites are considered deprecated

Parameterize both class and tests in JUnit 5

Is there a way to parameterize both test class (like you could do with Parameterized and @Parameters in JUnit 4) and test methods (like you could do with JUnitParams in JUnit 4 or with @ParameterizedTest in JUnit 5)? I need to get the Cartesian product of the parameters in the end. Example of a partial test for java.nio.ByteBuffer using the

JUnit 5 does not execute method annotated with BeforeEach

JUnit 5 does not invoke my method in a test class that is annotated with the @BeforeEach annotation, where I initialize some fields of the test object that are needed in the tests. When trying to access these fields inside a test method (method annotated with @Test) I obviously get a NullpointerException. So I added some output messages to the

@Before/@BeforeEach inheritance behaviour change JUnit4 / JUnit5

When migrating from JUnit4 to JUnit5 I found a change in the behaviour of JUnit4 and JUnit5 and wanted to check if the change was a bug in JUnit4 or in JUnit5 and how to do it correctly. Lets assume the following structure: One base class Another class that inherits from this base class And an actual test class If

Difference between junit-jupiter-api and junit-jupiter-engine

What’s the difference between maven modules junit-jupiter-api and junit-jupiter-engine? Is it necessary to include both dependencies in build.gradle? Do I need to provide both dependencies? Or only one dependency is enough? And do I need to add a dependency on junit-vintage-engine? Answer JUnit Prior to Version 5.4 From the docs: junit-jupiter-api JUnit Jupiter API for writing tests and extensions. junit-jupiter-engine

How to implement JUnit 4 parameterized tests in JUnit 5?

In JUnit 4 it was easy to test invariants across a bunch of classes by using the @Parameterized annotation. The key thing is that a collection of tests are being run against a single list of arguments. How to replicate this in JUnit 5, without using JUnit-vintage? @ParameterizedTest is not applicable to a test class. @TestTemplate sounded like it might

Eclipse JUnit 5 support

Currently, JUnit 5 is just out with a “stable” version. IntelliJ supports JUnit 5 according to the Website. My question is if eclipse is supporting JUnit 5 as well, and if not when it is going to be supported. With supported I mean if I can run JUnit 5 tests without the need for a @RunWith(PlatformRunner.class) annotation. EDIT October 2017: