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
abstracttest 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 aandimpl b, you create a test that extends theabstracttest and call the test methods defined in thetestsmodule.Regarding Maven :
In the
testsmodule, you will have to indicate to Maven that he has to create ajarof the tests package:Then, in each implementing module, you will have to indicate that you have a dependency to this
test-jarlibrary: