Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Running selenium test with maven-surefire-plugin or maven-failsafe-plugin?

i am confused between the concept of using maven-surefire-plugin or maven-failsafe-plugin to run my selenium tests in integration test phase (without running unit tests) i see some examples uses maven-surefire-plugin and other examples uses maven-failsafe-plugin

please advise with sample or link to configuration.

like image 425
fresh_dev Avatar asked Jan 16 '12 15:01

fresh_dev


People also ask

What is the difference between maven Surefire and maven failsafe plugins?

maven-surefire-plugin is designed for running unit tests and if any of the tests fail then it will fail the build immediately. maven-failsafe-plugin is designed for running integration tests, and decouples failing the build if there are test failures from actually running the tests.

What is the purpose of maven failsafe plugin?

The Failsafe Plugin is used during the integration-test and verify phases of the build lifecycle to execute the integration tests of an application. The Failsafe Plugin will not fail the build during the integration-test phase, thus enabling the post-integration-test phase to execute.

What is the purpose of maven surefire plugin?

The Surefire Plugin is used during the test phase of the build lifecycle to execute the unit tests of an application. It generates reports in two different file formats: Plain text files (*. txt)

Which maven plugin can be used to run tests?

Maven Surefire Plugin – Running a Single Test.


1 Answers

You should use the maven-failsafe-plugin for running selenium tests.

The failsafe plugin runs the tests in the integration-test phase, and does not fail the build when integration tests fail hence allowing maven to run the post-integration-test phase. failsafe plugin fails the build in the verify phase. This is important as one would usually do things like starting up the server/setting up data during the pre-integration-test phase, and shutdowns/cleanups at the post-integration-test phase while running selenium tests.

Look at the usage of the failsafe plugin and the maven lifecycles reference.

like image 102
MLN Avatar answered Oct 22 '22 09:10

MLN