Skip to content
Advertisement

JUnit 5 and Test Suites

We have a pure JUnit-5 project and we want to categories our unit tests.

To do so, what I understand is we need to include the JUnit-4 @RunWith(JUnitPlatform.class).

JavaScript

In Intellij-Idea I can run all or just test suites without problems but I get an error on the execution with maven:

  • in Intellij-Idea some test cases fail
  • on the console I have an endless loop

This didn’t help:

JavaScript

If I just remove all the XyzTestSuite.java classes the maven build is successful. I also tried <exclude>my.project.domain.testsuite</exclude>.

The exclution seams not to work. Why?

Advertisement

Answer

JUnitPlatform has been deprecated.

The corresponding new feature is the JUnit Platform Suite Engine: https://junit.org/junit5/docs/current/user-guide/index.html#junit-platform-suite-engine

However, if it’s just about categorising tests, tags, which are much simpler, might be sufficient: https://junit.org/junit5/docs/current/user-guide/index.html#writing-tests-tagging-and-filtering

User contributions licensed under: CC BY-SA
1 People found this is helpful
Advertisement