You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@maven.apache.org by Thomas Sundberg <ts...@kth.se> on 2010/08/27 12:34:34 UTC

Integration tests vs. unit tests

Hi!

This has been discussed previously. But I would like to ask the list
again, how do you separate integrations test from unit tests in a
Maven project?

I define unit tests as being tests that will run in memory and not use
any external resources. Anything external is mocked away. Everything
will run in memory and as fast as possible.

I define integration tests as tests that are dependent on other
resources than the source code. This is (at least):
* The file system
* Databases
* Network access

Assume that we are dealing with a multi module build, how would you
organize the modules? Would you consider adding a separate
'integration-test' tree next to main and test?

/Thomas

-- 
Thomas Sundberg
M. Sc. in Computer Science

Mobile: +46 70 767 33 15
Blog: http://thomassundberg.wordpress.com/
Twitter: @thomassundberg

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


Re: Integration tests vs. unit tests

Posted by Paul Benedict <pb...@apache.org>.
Thomas,

There isn't one right answer. Expect to find lots of variants.

I use a naming convention. Unit tests end in plain-old vanilla Test,
and integration tests end in *ITest. I use a wildcard pattern with
Maven to exclude integration tests since they are long-running and
need less execution. I can enable those, however, using a Maven
profile.

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

Paul

On Fri, Aug 27, 2010 at 5:34 AM, Thomas Sundberg <ts...@kth.se> wrote:
> Hi!
>
> This has been discussed previously. But I would like to ask the list
> again, how do you separate integrations test from unit tests in a
> Maven project?
>
> I define unit tests as being tests that will run in memory and not use
> any external resources. Anything external is mocked away. Everything
> will run in memory and as fast as possible.
>
> I define integration tests as tests that are dependent on other
> resources than the source code. This is (at least):
> * The file system
> * Databases
> * Network access
>
> Assume that we are dealing with a multi module build, how would you
> organize the modules? Would you consider adding a separate
> 'integration-test' tree next to main and test?
>
> /Thomas
>
> --
> Thomas Sundberg
> M. Sc. in Computer Science
>
> Mobile: +46 70 767 33 15
> Blog: http://thomassundberg.wordpress.com/
> Twitter: @thomassundberg
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: users-unsubscribe@maven.apache.org
> For additional commands, e-mail: users-help@maven.apache.org
>
>

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


Re: Integration tests vs. unit tests

Posted by Nayan Hajratwala <na...@chikli.com>.
On Aug 27, 2010, at 6:34 AM, Thomas Sundberg wrote:

> Assume that we are dealing with a multi module build, how would you
> organize the modules? Would you consider adding a separate
> 'integration-test' tree next to main and test?

I set it up like so:

	parent module
	|-- domain class module  <-- contains unit tests only
	|-- services module	<-- contains unit tests only
	|-- integration test module <-- int tests for all sibling level modules
	|-- webapp module
	|-- etc...

Additionally, since the tests typically run longer, i usually set up the integration test module so that it can be optionally invoked from a profile. This is how our continuous integration environment runs them.


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