4

I am looking at migrating the unit tests for a set of projects from JUnit4 to JUnit5. This is proving to be generally pretty straightforward. However there is one problem outstanding: how to run unit tests across all projects from within Eclipse.

With JUnit4 there is a simple solution using ClassPathSuite: create a new project which has all the other projects on it's classpath and add a single class with no methods:

@RunWith(ClasspathSuite.class)
public class RunAllTests {
}

This still works fine with tests written for JUnit4 and run with JUnit5 using the vintage engine. However once tests are converted to native JUnit5 ClassPathSuite no longer finds them.

Eclipse Oxygen (v4.9.0) Test configuration only allows tests to be configured within the confines of a single project, package or source folder so does not appear to offer a solution to this problem.

Any suggestions?

GeoffC
  • 41
  • 2

1 Answers1

1

JUnit 5.8 introduced @Suite and suite engine. This functionality seems to be similar to what ClasspathSuite JUnit 4 extension offers.

Eclipse seems to be working pretty well with JUnit 5 suites: suite run from Eclipse All the tests on the screenshot come from different projects.

Dawid Pytel
  • 2,750
  • 1
  • 23
  • 30