Intellipaat Back

Explore Courses Blog Tutorials Interview Questions
0 votes
in Java by (10.2k points)

I have a maven2 multi-module project and in each of my child modules I have JUnit tests that are named and for unit tests and integration tests respectively. When I execute:

mvn test

all of the JUnit tests * within the child modules are executed. When I execute

mvn test -Dtest=**/*Integration

none of the tests get execute within the child modules.

These seem like the exact same command to me but the one with the -Dtest=/*Integration** does not work it displays 0 tests being run at the parent level, which there are not any tests

1 Answer

0 votes
by (46k points)

You can set up Maven's Surefire to run unit tests and integration tests separately. In the standard unit test phase you run everything that does not pattern match an integration test. You then create a second test phase that runs just the integration tests.

Here is an example:



























Browse Categories