You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@maven.apache.org by Guy Davis <da...@guydavis.ca> on 2005/06/18 01:03:16 UTC

How to split unit and acceptance tests apart (both use Junit framework)

Hello,

I'm currently using Maven 1 for running our regular unit tests.  However 
I'm in the process of adding larger acceptance/integration tests that 
cover wide areas of functionality.  I am still using the JUnit framework 
for these acceptance tests, but I was wondering if there was a way to 
separate out these two test types.

The reason being is the time involved.  The standard unit tests run in 
no more than a couple of minutes. However the new acceptance tests 
require nearly an hour.

Ideally, running these acceptance tests would be a different goal 
(target).   I'm hoping to configure CruiseControl to run our unit tests 
on each build, but only acceptance tests on builds greater than 3 or 4 
hours apart.

Is this possible with Maven?  Perhaps with version 2?  Or does this 
require a custom plugin (based on the current unit test plugin)?

Thanks much,
Guy


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


Re: How to split unit and acceptance tests apart (both use Junit framework)

Posted by dan tran <da...@gmail.com>.
src/main/java is the maven recommend directory structure.  This way I can 
so have src/main/resources, both indicating they are belonging to the main
artifact.  It is more organized that way

<unitTestSourceDirectory> can only understand by maven-test-plugin
the real unit test. So if you point it to your main src, your tests will be
automatically invoked after compilation.  and you dont want that.

Last, if you put your integration test cases as the main artifact, then you can
use test:single in maven-test-plugin to invoke your integration.  Be prepare
to dig into maven-test-plugin to understand test:single requirement.
(hmm, perhaps we should start thinking about maven-integration-junit-plugin ;-)

-Dan


On 6/17/05, Craig McDaniel <cp...@gmail.com> wrote:
> What is the reasoning for the extra "main" level? Why not src/java.
> 
> Also, couldn't you just set the <unitTestSourceDirectory> to
> src/main/java and point <sourceDirectory> someplace empty? I am going
> to be going through this same process soon. Please share what you
> consider to be the best practice here (and why - it really helps to
> understand).
> 
> 
> On 6/17/05, dan tran <da...@gmail.com> wrote:
> > Guy,
> >
> > Move your integration/acception test to a separate maven project.
> > Treat it like an application so that you can invoke it on demain.
> > (ie all your test source goto src/main/java....)
> >
> > You many need to write some goal wrapper to invoke the test.
> >
> > -D
> >
> > On 6/17/05, Guy Davis <da...@guydavis.ca> wrote:
> > > Hello,
> > >
> > > I'm currently using Maven 1 for running our regular unit tests.  However
> > > I'm in the process of adding larger acceptance/integration tests that
> > > cover wide areas of functionality.  I am still using the JUnit framework
> > > for these acceptance tests, but I was wondering if there was a way to
> > > separate out these two test types.
> > >
> > > The reason being is the time involved.  The standard unit tests run in
> > > no more than a couple of minutes. However the new acceptance tests
> > > require nearly an hour.
> > >
> > > Ideally, running these acceptance tests would be a different goal
> > > (target).   I'm hoping to configure CruiseControl to run our unit tests
> > > on each build, but only acceptance tests on builds greater than 3 or 4
> > > hours apart.
> > >
> > > Is this possible with Maven?  Perhaps with version 2?  Or does this
> > > require a custom plugin (based on the current unit test plugin)?
> > >
> > > Thanks much,
> > > Guy
> > >
> > >
> > > ---------------------------------------------------------------------
> > > 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
> >
> >
> 
> 
> --
> Craig McDaniel
>

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


Re: How to split unit and acceptance tests apart (both use Junit framework)

Posted by Craig McDaniel <cp...@gmail.com>.
What is the reasoning for the extra "main" level? Why not src/java.

Also, couldn't you just set the <unitTestSourceDirectory> to
src/main/java and point <sourceDirectory> someplace empty? I am going
to be going through this same process soon. Please share what you
consider to be the best practice here (and why - it really helps to
understand).


On 6/17/05, dan tran <da...@gmail.com> wrote:
> Guy,
> 
> Move your integration/acception test to a separate maven project.
> Treat it like an application so that you can invoke it on demain.
> (ie all your test source goto src/main/java....)
> 
> You many need to write some goal wrapper to invoke the test.
> 
> -D
> 
> On 6/17/05, Guy Davis <da...@guydavis.ca> wrote:
> > Hello,
> >
> > I'm currently using Maven 1 for running our regular unit tests.  However
> > I'm in the process of adding larger acceptance/integration tests that
> > cover wide areas of functionality.  I am still using the JUnit framework
> > for these acceptance tests, but I was wondering if there was a way to
> > separate out these two test types.
> >
> > The reason being is the time involved.  The standard unit tests run in
> > no more than a couple of minutes. However the new acceptance tests
> > require nearly an hour.
> >
> > Ideally, running these acceptance tests would be a different goal
> > (target).   I'm hoping to configure CruiseControl to run our unit tests
> > on each build, but only acceptance tests on builds greater than 3 or 4
> > hours apart.
> >
> > Is this possible with Maven?  Perhaps with version 2?  Or does this
> > require a custom plugin (based on the current unit test plugin)?
> >
> > Thanks much,
> > Guy
> >
> >
> > ---------------------------------------------------------------------
> > 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
> 
> 


-- 
Craig McDaniel

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


Re: How to split unit and acceptance tests apart (both use Junit framework)

Posted by dan tran <da...@gmail.com>.
Guy,

Move your integration/acception test to a separate maven project.
Treat it like an application so that you can invoke it on demain.
(ie all your test source goto src/main/java....)

You many need to write some goal wrapper to invoke the test.

-D

On 6/17/05, Guy Davis <da...@guydavis.ca> wrote:
> Hello,
> 
> I'm currently using Maven 1 for running our regular unit tests.  However
> I'm in the process of adding larger acceptance/integration tests that
> cover wide areas of functionality.  I am still using the JUnit framework
> for these acceptance tests, but I was wondering if there was a way to
> separate out these two test types.
> 
> The reason being is the time involved.  The standard unit tests run in
> no more than a couple of minutes. However the new acceptance tests
> require nearly an hour.
> 
> Ideally, running these acceptance tests would be a different goal
> (target).   I'm hoping to configure CruiseControl to run our unit tests
> on each build, but only acceptance tests on builds greater than 3 or 4
> hours apart.
> 
> Is this possible with Maven?  Perhaps with version 2?  Or does this
> require a custom plugin (based on the current unit test plugin)?
> 
> Thanks much,
> Guy
> 
> 
> ---------------------------------------------------------------------
> 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