failsafe itself does not manage the lifecycle of your container.

Maven has a lifecycle with some phases:

pre-integration-test: to be used to start any services required by your
integration tests
integration-test: to be used to run the integration tests
post-integration-test: to be used to stop any services started in
pre-integration-test
verify: to be used to verify the results of the integration tests

*if* you use surefire:test in the `integration-test` phase *then* a failing
test will mean that the `post-integration-test` phase will never be run. If
you are using, for example, a jetty/tomcat container that reuses the Maven
JVM then this will normally not be any major harm (unless you are running
maven in embedded mode) as the test failure will tear down the JVM and stop
the container... but for more complex cases you may be: starting a docker
container that hosts a test DB, forking a JVM to host the other things,
creating some resources on a shared external database, etc.

In that scenario, none of them will be tidied up if you use surefire. Using
failsafe allows you to split the verification from the execution.

Of course you do not have to use failsafe or the maven lifecycle for
this... you could just have your tests start and stop the external
resources as required... there is an advantage to not using the maven
lifecycle... namely that your tests are easier to run from an IDE... but
with that advantage comes a cost... namely each test has to start and stop
the resources... that cost may be worth it, especially if you want a clean
container between tests... but then integration tests are not unit tests
and probably expect an explicit execution sequence... in which case the
trade-off may not ne required.

failsafe gives you options... if you don't need them you can just use
surefire

On 29 August 2016 at 14:09, Martin Gainty <mgai...@hotmail.com> wrote:

>
>
> > From: stephen.alan.conno...@gmail.com
> > Date: Mon, 29 Aug 2016 13:33:34 +0100
> > Subject: Re: Does Failsafe Require Jetty?
> > To: users@maven.apache.org
> >
> > Failsafe does not require jetty. If your integration tests require that
> > your application be deployed to a servlet container - such as jetty - and
> > you do not want to have your tests manage the lifecycle of that
> container,
> > then you will require failsafe so that you can have maven manage starting
> > up and tearing down the container (and any additional required resources)
> > around the test execution.
> MG>yes my preference would be to manage the container lifeycle outside of
> failsafe
> MG>i found *some* maven-jetty-plugin doc on sonatypeMG>http://books.
> sonatype.com/mvnex-book/reference/web-sect-configuring-jetty.htmlMG>archetype
> creation for maven-jetty-plugin to create index.jsp and web.xml is
> sparse..can you suggest better site?MG>Thanks
> >
> > On 15 August 2016 at 14:35, Richard W. Adams <rwada...@up.com> wrote:
> >
> > > I've been taking a first look at documentation for the Failsafe
> plugin. It
> > > looked straightforward until I got to the part that discussed Jetty.  I
> > > found the Jetty section confusing, as it seems to imply that Jetty is
> > > required to Failsafe. I hope I'm misunderstanding it, and that Failsafe
> > > can be run *without* Jetty.
> > >
> > > Another point where I found the documentation somewhat lacking:  Under
> > > what scenarios would I WANT to run Jetty & Failsafe together? Is this
> only
> > > for server applications, or is there some other use case I'm
> overlooking?
> > >
> > >
> > > **
> > >
> > > This email and any attachments may contain information that is
> > > confidential and/or privileged for the sole use of the intended
> recipient.
> > > Any use, review, disclosure, copying, distribution or reliance by
> others,
> > > and any forwarding of this email or its contents, without the express
> > > permission of the sender is strictly prohibited by law.  If you are
> not the
> > > intended recipient, please contact the sender immediately, delete the
> > > e-mail and destroy all copies.
> > > **
> > >
>
>

Reply via email to