12
votes

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.

1

1 Answers

14
votes

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.