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.
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.
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.
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)
Maven Surefire Plugin – Running a Single Test.
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.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With