Benefits of Maven FailSafe Plugin

keheliya picture keheliya · Feb 18, 2012 · Viewed 10.7k times · Source

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 conflicts with unit tests since only integration tests are run in the test phase in that module. And to set up the environment before the tests, and clean it after tests are run, @BeforeSuite @AfterSuite TestNg annotations are used. So there's no need to make use of pre-integration-test phase, integration-test phase, post-integration-test phase utilized by Failsafe plugin.

  • Are there any more benefits I'm missing out on, by not using the Failsafe plugin?
  • Are there better ways to do my current requirement using Failsafe plugin?
  • Can I do my server startup, shut down, file unzipping etc. in the pre-integration-test, post-integration-test phases without writing a maven plugin?

Answer

Aleksandr Dubinsky picture Aleksandr Dubinsky · Feb 19, 2012

Failsafe has one big feature vs Surefire: When a test fails, it does not immediately abort. Instead it lets the clean-up code run (which typically takes down the Jetty server).