Questions tagged [maven-failsafe-plugin]

The Maven Failsafe Plugin is used to run integration tests with Maven build tools.

The Maven Failsafe Plugin is designed to run integration tests while the Surefire Plugin is designed to run unit tests. The name (failsafe) was chosen both because it is a synonym of surefire and because it implies that when it fails, it does so in a safe way.

This plugin is strictly linked to the following Maven phases: integration-test, verify. However, during its usage, the pre-integration-test and post-integration-test phases are also often used (i.e. set-up and tear-down of an embedded web server).

Check the official usage page for a first look at this plugin.

375 questions
192
votes
7 answers

Prevent unit tests but allow integration tests in Maven

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…
142
votes
3 answers

What is the difference between the Maven Surefire and Maven Failsafe plugins?

What is the difference between Maven Surefire and Maven Failsafe plugins? I have searched all over web, but did not get the answer.
bugCracker
  • 3,656
  • 9
  • 37
  • 58
70
votes
7 answers

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

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…
52
votes
13 answers

Maven fail-safe not executing tests

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…
dingalla
  • 1,219
  • 3
  • 12
  • 19
44
votes
10 answers

Merging Integration and Unit test reports with JaCoCo

I am generating failsafe and surefire reports with maven with the JaCoCo plugin, but I can only manage to get them in separate reports. I would like to have a overall coverage view (merge between both Unit Tests and Integration Tests) as well.…
42
votes
1 answer

Maven separate Unit Test and Integration Tests

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…
35
votes
3 answers

Benefits of Maven FailSafe Plugin

I read Maven Failsafe plugin is designed specifically to run integration tests. Currently I'm working on a multi-module project and integration tests are in its own separate module, written in TestNg and run using Surefire plugin. We don't have…
35
votes
1 answer

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

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…
Sled
  • 18,541
  • 27
  • 119
  • 168
31
votes
4 answers

maven-failsafe-plugin Errors and BUILD SUCCESS?

my question is very similar to this one: maven-failsafe-plugin Failures and BUILD SUCCESS? and I manage to set up failsafe plugin to fail if tests fail. But if test goes into error state, failsafe plugin still does not break the…
udik
  • 357
  • 1
  • 4
  • 11
26
votes
3 answers

Problem running tests with enabled preview features in surefire and failsafe

I'm trying to migrate a project to Java 12, with --enable-preview. I added --enable-preview in compiler settings: maven-compiler-plugin
24
votes
2 answers

How do I detect my test is running on a Jenkins environment?

I have a JUnit test using Assumption to skip the test if the developer's computer doesn't have the pre-requisite software for running it. Despite being "junit", it's an integration test. Something like this: int isSoftwarePresent = new…
Daniel C. Sobral
  • 295,120
  • 86
  • 501
  • 681
24
votes
5 answers

Maven Failsafe plugin - SurefireBooterForkException: There was an error in the forked process (TypeNotPresentExceptionProxy)

I get this strange stacktrace when running mvn clean verify -P P1 [ERROR] Failed to execute goal org.apache.maven.plugins:maven-failsafe-plugin:2.21.0:verify (default) on project prj-name: There are test failures. [ERROR] [ERROR] Please refer to…
naXa stands with Ukraine
  • 35,493
  • 19
  • 190
  • 259
22
votes
4 answers

maven-failsafe-plugin Failures and BUILD SUCCESS?

I want to use maven-failsafe-plugin to run some integration tests. If any test fails, I want Maven to fail the build and not BUILD SUCCESS. Tests run: 103, Failures: 1, Errors: 0, Skipped: 26 [INFO] BUILD SUCCESS* how can I configure it, that…
Fawi
  • 473
  • 2
  • 7
  • 21
19
votes
2 answers

How do I run JUnit 5 integration tests with the Maven Failsafe plugin?

The Maven Failsafe plugin won't find my JUnit 5 integration tests when I'm running the command mvn clean failsafe:integration-test, although it can find the files. I have the junit-jupiter-api and junit-jupiter-engine as test…
Panda TG Attwood
  • 1,468
  • 2
  • 16
  • 31
18
votes
2 answers

How to skip maven phase pre-integration-test if skipITs is set?

I have some integration tests that depend on test data. This test data is created in phase pre-integration-test and removed in phase post-integration-test. My problem is that these phases are still executed if I use -DskipITs on the Maven…
1
2 3
24 25