Reputation: 213
I have a multi-module project with unit tests and integration tests. We're using Jenkins for our pipeline:
What I want to achieve is:
Step three starts from a clean checkout, so there isn't even a target
folder.
Edit - the integration test run inside a profile, so they don't run during the first build
What I want to achieve is to run the integration tests (step three) without compiling the code.
If I use mvn failsafe:integration-tests
it says that there aren't any tests (obviously because it doesn't find any artifact).
When I add dependenciesToScan
it says that it doesn't find the junit provider (groups/excludedGroups require TestNG, JUnit48+ or JUnit 5 on project test classpath
).
Can someone help on how to implement running the tests when the jars are in the local repo, without compiling?
Upvotes: 4
Views: 2845
Reputation: 42541
In maven there is a concept of phases attached to a lifecycle.
The plugins goals are attached to phases.
See here for more information
When you run:
mvn verify
Its actually running all phases up-to (including) verify and invoke all the plugins attached to these phases.
So if you want to skip running integration tests during the mvn verify
you can do:
mvn verify -DskipITs=true
Now if you want to run only integration tests, you can just invoke failsafe plugin without calling a full "cycle" (compilation, unit tests, etc.):
mvn failsafe:integration-test
Of course this assumes that the compilation has been already done, and the binary compiled files already reside in the target directory
Upvotes: 6
Reputation: 2683
I did something similar several times. My standard solution is to put the system test suite in a separate module next to the actual artifact in the same repository.
Steps one and two would happen only within the service module, while step three happens in the system-test module running mvn verify
.
Upvotes: 1