maven-failsafe-plugin

Maven separate Unit Test and Integration Tests

两盒软妹~` 提交于 2019-11-30 10:47:17
问题 UT = Unit Tests IT = Integration Tests. All my Integration test classes are annotated with @Category(IntegrationTest.class) My goal is: mvn clean install => runs UT and not IT mvn clean install -DskipTests=true => no tests are executed mvn clean deploy => runs UT and not IT mvn clean test => runs UT and not IT mvn clean verify => runs UT and IT mvn clean integration-test => runs IT and UT are not executed mvn clean install deploy => runs UT and not IT pom properties: <junit.version>4.12<

Maven fail-safe not executing tests

僤鯓⒐⒋嵵緔 提交于 2019-11-30 05:43:20
I've combed StackOverflow and many other sites, have found many other related posts and have followed all said suggestions, but in the end, failsafe is skipping my tests. My JUnit test is located here: myModule/src/main/test/java/ClientAccessIT.java I am skipping surefire because there are no unit tests in this module: <!-- POM snippet --> <plugin> <groupId>org.apache.maven.plugins</groupId> <artifactId>maven-surefire-plugin</artifactId> <configuration> <skip>true</skip> </configuration> </plugin> And I'm trying to run integration tests with failsafe : <!-- POM snippet --> <plugin> <groupId

In Maven is it possible to keep integration tests in a separate folder from unit tests?

末鹿安然 提交于 2019-11-29 16:25:40
问题 On the Maven and Integration Testing page it says: The Future Rumor has it that a future version of Maven will support something like src/it/java in the integration-test phase, in addition to src/test/java in the test phase. but that was back in 2011-12-11. Has this happened yet? In this answer to "Run maven test not in default src/test/java folder" it mentions setting the <testSourceDirectory> , is their some way of doing this just for integration test (ie. the integration-test phase)? I'm

Maven Failsafe Classpath

一世执手 提交于 2019-11-29 11:31:09
I've started a new project: PostfixSQLConfig . It's a simple Spring Boot application that is essentialy supposed to provide CRUD access for 4 simple databse tables. I wrote the the repository for the first table and some basic integration tests for said repository. Since this particular table should not provide update functionality, I implemented update function as: @Override public void update(@NonNull Domain domain) throws NotUpdatableException { throw new NotUpdatableException("Domain entities are read-only"); } where NotUpdatableException is my custom exception class. The IT for this code

Where should the integration tests be stored when using the maven-failsafe-plugin?

非 Y 不嫁゛ 提交于 2019-11-29 10:16:49
Do I have to place my integration tests under src/test with the rest of my unit tests and just distinguish them by a pattern such as *Integr*Test , *ITTest , or can they be in src/it (as is the case when developing Maven plugins and using the maven-invoker-plugin )? I'm asking this because, to me it looks not clean enough if both unit and integration tests are in the same place, (even if they were to be controlled via a Maven profile). First maven-fails-plugin runs by default in another life cycle phase (integration-test) as maven-surefire-plugin (test) does. Furthermore you can configurate

Maven Failsafe Classpath

落爺英雄遲暮 提交于 2019-11-28 05:33:10
问题 I've started a new project: PostfixSQLConfig. It's a simple Spring Boot application that is essentialy supposed to provide CRUD access for 4 simple databse tables. I wrote the the repository for the first table and some basic integration tests for said repository. Since this particular table should not provide update functionality, I implemented update function as: @Override public void update(@NonNull Domain domain) throws NotUpdatableException { throw new NotUpdatableException("Domain

Where should the integration tests be stored when using the maven-failsafe-plugin?

依然范特西╮ 提交于 2019-11-28 03:26:12
问题 Do I have to place my integration tests under src/test with the rest of my unit tests and just distinguish them by a pattern such as *Integr*Test , *ITTest , or can they be in src/it (as is the case when developing Maven plugins and using the maven-invoker-plugin )? I'm asking this because, to me it looks not clean enough if both unit and integration tests are in the same place, (even if they were to be controlled via a Maven profile). 回答1: First maven-fails-plugin runs by default in another

Maven Failsafe Plugin: how to use the pre- and post-integration-test phases

跟風遠走 提交于 2019-11-27 22:14:12
It is not completely clear to me how to best use the Maven Failsafe plugin for integration tests. My use case would be to test SQL queries against a local MySQL database. I understand that the database should be started during the pre-integration-test phase, and shut down during the post-integration-test . But how do I specify that? Is there a command line I should put in my pom.xml? Or a method that I should annotate with a specific annotation? Jcs In the regular built-in maven lifecycles (jar, war...) the pre-integration-test and post-integration-test test phases are not bound to any maven

How can I skip tests in maven install goal, while running them in maven test goal?

…衆ロ難τιáo~ 提交于 2019-11-27 06:06:42
I have a multi-module maven project with both integration and unit tests in the same folder (src/test/java). Integration tests are marked with @Category(IntegrationTest.class) . I want to end up with the following setup: If I run mvn install , I want all tests to compile, but I do not want to execute any. If I run mvn test , I want all tests to compile, but execute only unit tests. If I run mvn integration-test , I want to compile and execute all tests. The important point is, I want this configured in the pom.xml without any extra commandline arguments. Currently I came up with the following

Prevent unit tests but allow integration tests in Maven

試著忘記壹切 提交于 2019-11-27 05:51:42
I've a Maven build in which I use the SureFire plugin to run some unit tests, and the FailSafe plugin to run some integration tests. I would like a way to run just the FailSafe plugin's tests. It's not a good solution for me to add different profiles or anything in the pom, because it's a multimodule build and I don't want to have to edit every module's pom. There are skip.tests and maven.test.skip and skipTests which stop all tests, and skipITs , which stops only the failsafe plugin. So, is there a command-line flag for Maven like skipITs , but instead with the functionality of "onlyITs"? I