简体   繁体   中英

How can i run only the unit tests not the integration tests on build phase with maven

I added the maven-failsafe-plugin to my project for runnig integration tests. When i run test only unit tests are running and when i run integration-test first unit tests and then integration tests are running.

It's all what i want so far but when i clean and build the project both unit tests and integration tests are running which i wouldn't prefer because i just don't want to prepare the environment for integration testing on every build. I clean and build the project for some generated source to regenerate and i don't want to run the integration test meanwhile.

Is there a way that i only run the integration tests on purpose not by any automation?

I added -DskipITs flag clean install command of maven so integration tests are not running when i make a call of clean and install.

And i created maven goals as integration-test and verify to run and verify the integration tests via the failsafe plugin which i added to my pom.xml .

As i'm using netbeans as ide, i set the predefined maven commands via the actions tab of the project properties and i can run the integraion tests via right click to peoject and integration test sub menu under maven menu.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM