I think it's important to realize there is four phases involved:

pre-integration-test
integration-test
post-integration-test
verify

During "post-integration-test" you have an opportunity to clean up all the 
complicated setup that you did in order to run the integration tests, before 
"verify" halts the build (if there is test failures).

This rigor is only needed for tests with some moving parts. If you need to 
setup a database, and an application server with your WAR, which are then 
exercised by your test code (which would still often be in JUnit), just to give 
an example, this may be for you.

If this is "just" a larger kind of JUnit test, that can still run 
self-contained, but perhaps happens to violate the "a unit test tests only a 
single class" paradigm, and that may have IntegrationTest in its name, that may 
then not be an integration test the way Maven means it.



Sander Verhagen
[  san...@sanderverhagen.net  ]

NOTICE: my e-mail address has changed. You may still e-mail me at 
verha...@sander.com but you will see me using san...@sanderverhagen.net from 
now on. Feel free to update your address book.


-------- Original message --------
From: Stephen Connolly <stephen.alan.conno...@gmail.com>
Date:25/05/2015 07:25 (GMT-08:00)
To: Maven Users List <users@maven.apache.org>
Cc:
Subject: Re: what is the difference between failsafe's integration test and 
verify?

failsafe:integration-test runs the tests and stores whether the tests
passed or failed in a file

failsafe:verify reads back that file and then if there were failing tests
it fails the build.



On 25 May 2015 at 15:06, hongbin ma <mahong...@apache.org> wrote:

> hi, I'm new to failsafe,
>
> i'm starting to move a test case from unit test to integration test, and
> i'm using
>
> <plugin>
>     <groupId>org.apache.maven.plugins</groupId>
>     <artifactId>maven-failsafe-plugin</artifactId>
>     <executions>
>         <execution>
>             <id>integration-tests</id>
>             <phase>integration-test</phase>
>             <goals>
>                 <goal>integration-test</goal>
>                 <goal>verify</goal>
>             </goals>
>         </execution>
>     </executions>
>
> ​in my pom.
>
> When I run "mvn verify", I ​found my new integration test ran twice.
> I realized that both the "integration-test" and "verify" goal may
> contribute to it.
> Should I remove the line "<goal>verify</goal>" in pom?
> But It seems most failsafe tutorials keeps both goals in their poms.
>
> The question is, what are these two goals for?
> The official explanation:
>
> *integration-test for running the integration tests.*
> *verify for checking the results of the integration tests.*
>
> seems so vague to me.
> Can any expert give me a concrete example?
>
> thanks!
>
> --
> Regards,
>
> *Bin Mahone | 马洪宾*
> Apache Kylin: http://kylin.io
> Github: https://github.com/binmahone
>

Reply via email to