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?

parent
|-interface
|-impl a
|-impl b
|-tests

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:

<build>
    <plugins>
        <plugin>
            <groupId>org.apache.maven.plugins</groupId>
            <artifactId>maven-jar-plugin</artifactId>
            <version>2.3</version>
            <executions>
                <execution>
                    <goals>
                        <goal>test-jar</goal>
                    </goals>
                </execution>
            </executions>
        </plugin>

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

    <dependency>
        <groupId>foo</groupId>
        <artifactId>bar</artifactId>
        <version>${pom.version}</version>
        <type>test-jar</type>
        <scope>test</scope>
    </dependency>