英文:
How can i run only the unit tests not the integration tests on build phase with maven
问题
我将maven-failsafe-plugin
添加到我的项目中以运行集成测试。当我运行test
时,只会运行单元测试;当我运行integration-test
时,会先运行单元测试,然后再运行集成测试。
到目前为止,这正是我想要的。但是,当我清理并构建项目时,会同时运行单元测试和集成测试,我不太希望这样,因为我并不想在每次构建时都准备集成测试的环境。
我进行项目的清理和构建是为了重新生成一些生成的源代码,而我不想同时运行集成测试。
有没有办法只在有意的情况下运行集成测试,而不是通过任何自动化方式运行?
英文:
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?
答案1
得分: 0
我在Maven的clean install
命令中添加了-DskipITs
标志,以便在执行clean和install操作时不运行集成测试。
我创建了Maven目标integration-test
和verify
,通过failsafe plugin
运行和验证集成测试,我已将该插件添加到了我的pom.xml
中。
由于我使用NetBeans
作为集成开发环境,我通过项目属性的操作选项卡设置了预定义的Maven命令,我可以通过右键点击项目,然后在Maven菜单下选择集成测试子菜单来运行集成测试。
英文:
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.
通过集体智慧和协作来改善编程学习和解决问题的方式。致力于成为全球开发者共同参与的知识库,让每个人都能够通过互相帮助和分享经验来进步。
评论