You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@maven.apache.org by Kevin Burton <bu...@spinn3r.com> on 2014/10/08 01:28:28 UTC

Best practice for integration tests (vs unit tests)

Right now I have an overlap of unit and integration tests and I want to
tear out my integration tests and keep them separate.  This way our unit
tests execute fast and integration testing takes a bit longer.

… and now I’m trying to figure out the best strategy for that.

Reading this:

http://docs.codehaus.org/display/MAVENUSER/Maven+and+Integration+Testing

seems to not solve the problem.

Seems to me the easiest would be to just have src/main/integration-tests

… but would I have to use failsafe or surefire?  I’m not sure why I would
need another plugin for this.

Maybe someone can enlightenment me with some maven wisdom?

-- 

Founder/CEO Spinn3r.com
Location: *San Francisco, CA*
blog: http://burtonator.wordpress.com
… or check out my Google+ profile
<https://plus.google.com/102718274791889610666/posts>
<http://spinn3r.com>

Re: Best practice for integration tests (vs unit tests)

Posted by Karl Heinz Marbaise <kh...@gmx.de>.
Hi Kevin,


the best suggestion i can give is simply make a separate module where 
the integration tests should be moved to...


This has the advantage having different location for them, cause they 
are more than unit tests which is expressed by using a separate module 
furthermore you have the configuration for the integration test within a 
separate module which is more flexible this includes the configuration 
of maven-failsafe-plugin as well.

maven-failsafe-plugin should be used cause it supports a different 
naming schema for your integration tests (*IT.java see docs of 
maven-failsafe-plugin) and you can check the results of the integration 
tests via maven-failsafe-plugin:verify separately...and break the build 
if you like...

Apart from the above integration tests should run at an other phase 
(pre-integration-test,integration-test, post-integration) and NOT in 
test phase...which is handled by maven-failsafe-plugin (see docs 
http://maven.apache.org/surefire/maven-failsafe-plugin/usage.html)

So if you like to run your unit tests parallel you can configure the 
maven-surefire-plugin which does not influence your integration tests...


I would also suggest to put the integration tests into src/test/java 
within the separated module....

Kind regards
Karl-Heinz Marbaise

On 10/8/14 1:28 AM, Kevin Burton wrote:
> Right now I have an overlap of unit and integration tests and I want to
> tear out my integration tests and keep them separate.  This way our unit
> tests execute fast and integration testing takes a bit longer.
>
> … and now I’m trying to figure out the best strategy for that.
>
> Reading this:
>
> http://docs.codehaus.org/display/MAVENUSER/Maven+and+Integration+Testing
>
> seems to not solve the problem.
>
> Seems to me the easiest would be to just have src/main/integration-tests
>
> … but would I have to use failsafe or surefire?  I’m not sure why I would
> need another plugin for this.
>
> Maybe someone can enlightenment me with some maven wisdom?
>


---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@maven.apache.org
For additional commands, e-mail: users-help@maven.apache.org


RE: [maven] Best practice for integration tests (vs unit tests)

Posted by Jason Pyeron <jp...@pdinc.us>.
> -----Original Message-----
> From: Kevin Burton
> Sent: Tuesday, October 07, 2014 19:28
> 
> Right now I have an overlap of unit and integration tests and 
> I want to
> tear out my integration tests and keep them separate.  This 
> way our unit
> tests execute fast and integration testing takes a bit longer.
> 
> . and now I'm trying to figure out the best strategy for that.
> 
> Reading this:
> 
> http://docs.codehaus.org/display/MAVENUSER/Maven+and+Integration+Testing
> 
> seems to not solve the problem.

Try: http://stackoverflow.com/questions/1399240/how-do-i-get-my-maven-integration-tests-to-run

> 
> Seems to me the easiest would be to just have 
> src/main/integration-tests
> 
> . but would I have to use failsafe or surefire?  I'm not sure 
> why I would
> need another plugin for this.
> 
> Maybe someone can enlightenment me with some maven wisdom?

This may not be in line with what you are looking for, but we typically move our integration tests to a separate pom.xml which has the primary pom as a dependency.


--
-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-
-                                                               -
- Jason Pyeron                      PD Inc. http://www.pdinc.us -
- Principal Consultant              10 West 24th Street #100    -
- +1 (443) 269-1555 x333            Baltimore, Maryland 21218   -
-                                                               -
-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-
This message is copyright PD Inc, subject to license 20080407P00. 



---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@maven.apache.org
For additional commands, e-mail: users-help@maven.apache.org