Maven: How to test two modules with the same tests in a third module

Imagine a maven project with 3 modules, an interface module and two different implementations of this interface in a module each. I could test each implementation in its own module, but the test cases are basically the same, because of the same interface.

Is there a way to collect the test cases in a fourth maven module and test the two implementations with this module?

|-impl a
|-impl b

So that if I build impl a, maven knows to run the tests from the tests module against the impl a build.

Thank you.

Regarding Java:

What about creating an abstract test in the tests module, where you will write the main tests cases. This test will use the interface defined in the first module in the test.

Then, in each module impl a and impl b, you create a test that extends the abstract test and call the test methods defined in the tests module.

Regarding Maven :

In the tests module, you will have to indicate to Maven that he has to create a jar of the tests package:


Then, in each implementing module, you will have to indicate that you have a dependency to this test-jar library: