You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@maven.apache.org by Pete <pe...@gmail.com> on 2006/02/11 21:40:54 UTC

Re: How to bind execution of integration tests to integration-test phase

I have achieved integration testing (both JunitEE/Cactus and JUnits calling
remote interfaces) in M2 using a very simple lightweight POM for each
discrete task/execution in the integration phase e.g.

+ runtests-integration
     pom.xml   (parent pom, invoking child modules in the order below)
    + rebuild-database
           pom.xml  (antrun)
    + start-container
           pom.xml  (antrun or cargo)
    + runtests-serverside  (runs junits needing server started as they
invoke remote interfaces)
           pom.xml (surefire:test)
    + runtests-incontainer-tests
           pom.xml (antrun for running JUnitEE or Cactus incontainer tests)
    + stop-container
           pom.xml (antrun or cargo)

All plugins above bound to the integration-test phase

I found this approach also necessary, because you can only have one instance
of the antRun plugin for the integration-test phase, therefore you can't use
antrun, then surefire, then antrun again  as the last antrun overrides the
first if they are bound to the same phase.

I did want to use Cargo, but unfortunately there was no support for OC4J
with an existing configuration.

I have the above 'runtests-integration' suite only execute if the M2 build
profile is set to -Pintegrationtests. In this way developers can run a
regular M2 build which just runs standalone JUnits, or specify the profile
to run a fuller build. We have CruiseControl always running the integrations
tests profile.

With m2.02 I should now convert the Antruns to Ant Plugins.

I'm hoping that when M2 supports integration tests more I can migrate to the
approved strategy, but this works right now, we have Applications (both
EARs) that are built with M2 via CruiseControl, the above integration
projects start the container run all the integration tests (with the 2nd EAR
application even invoking the 1st EAR's services)

I have two other M2 modules in addition to those shown above that actually
hold the integration tests :-

+ tests-serverside
      pom.xml   (JAR pom, building those JUnits needing server started as
they invoke remote interfaces)
+ tests-incontainer
     pom.xml  (JAR pom, building those JUnits needing to run inside
container JUnitEE or cactus)

Pete


On 10/01/06, Bengt-Erik Fröberg <Be...@ki.se> wrote:
>
> OK, kinda' weird actually... is it a hard task to extend this surefire
> plugin to support different kinds of tests?
>
> It would be great if you were able to define your own set of directories
> with tests of different types and to optionally bind each directory to a
> custom phase.
> Maybe a <tests>-tag in the POM?
> I saw there is already a discussion on these matters in the link you
> submitted. That's great!
>
> Regards,
>
> /B-E
>
>
>
> -----Ursprungligt meddelande-----
> Från: Vincent Massol [mailto:vmassol@pivolis.com]
> Skickat: den 10 januari 2006 16:38
> Till: 'Maven Users List'
> Ämne: RE: How to bind execution of integration tests to integration-test
> phase
>
>
>
> > -----Original Message-----
> > From: Bengt-Erik Fröberg [mailto:Bengt-Erik.Froberg@ki.se]
> > Sent: mardi 10 janvier 2006 16:28
> > To: 'Maven Users List'
> > Subject: SV: How to bind execution of integration tests to integration-
> > test phase
> >
> > Hi and thanks for answering.
> >
> > I see.... but what does the integration-test phase actually do today
> then?
>
> It's a phase you can bind to. What I'm simply saying is that the surefire
> plugin currently only supports running one type of tests at once.
>
> -Vincent
>
> > -----Ursprungligt meddelande-----
> > Från: Vincent Massol [mailto:vmassol@pivolis.com]
> > Skickat: den 10 januari 2006 16:12
> > Till: 'Maven Users List'
> > Ämne: RE: How to bind execution of integration tests to integration-test
> > phase
> >
> > Hi,
> >
> > > -----Original Message-----
> > > From: Bengt-Erik Fröberg [mailto:Bengt-Erik.Froberg@ki.se]
> > > Sent: mardi 10 janvier 2006 14:34
> > > To: 'Maven Users List'
> > > Subject: How to bind execution of integration tests to
> integration-test
> > > phase
> > >
> > >
> > >
> > > Hi
> > >
> > > I have a set of JUnit unit tests which are executed during the test
> > > lifecycle phase.
> > >
> > > Now I want to add integration-test classes in another directory to be
> > > executed during the integration-test phase.
> > > How do I accomplish that?
> > >
> > > Using  Maven2 and ANT.
> >
> > Right now you can't run both unit tests and integration tests in the
> same
> > project. We're discussing this and we'll probably modify the surefire
> > plugin
> > to allow it.
> >
> > See
> >
> http://docs.codehaus.org/display/MAVEN/best+practices+-+testing+strategies
> >
> > Thanks
> > -Vincent
> >
> >
> >
> >
> >
> >
> >
> __________________________________________________________________________
> > _
> > Nouveau : téléphonez moins cher avec Yahoo! Messenger ! Découvez les
> > tarifs
> > exceptionnels pour appeler la France et l'international.
> > Téléchargez sur http://fr.messenger.yahoo.com
> >
> > ---------------------------------------------------------------------
> > 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
>
>
>
>
>
>
>
> ___________________________________________________________________________
> Nouveau : téléphonez moins cher avec Yahoo! Messenger ! Découvez les
> tarifs
> exceptionnels pour appeler la France et l'international.
> Téléchargez sur http://fr.messenger.yahoo.com
>
> ---------------------------------------------------------------------
> 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: How to bind execution of integration tests to integration-test phase

Posted by Vincent Massol <vm...@pivolis.com>.
Hi Pete,

Yes, you've found the only possible way as of now to perform integration
testing with Maven 2. As you say yourself, Maven 2 need to offer better
support for integration testing to make it more streamlined and less
complex.

Thanks a lot for your feedback!
-Vincent

PS: Would you be interested in helping us implement existing configuration
support for Orion/OC4J? If so, please join us on the Cargo dev list and we
can discuss it!

> -----Original Message-----
> From: Pete [mailto:petelists@gmail.com]
> Sent: samedi 11 février 2006 21:41
> To: Maven Users List
> Subject: Re: How to bind execution of integration tests to integration-
> test phase
> 
> I have achieved integration testing (both JunitEE/Cactus and JUnits
> calling
> remote interfaces) in M2 using a very simple lightweight POM for each
> discrete task/execution in the integration phase e.g.
> 
> + runtests-integration
>      pom.xml   (parent pom, invoking child modules in the order below)
>     + rebuild-database
>            pom.xml  (antrun)
>     + start-container
>            pom.xml  (antrun or cargo)
>     + runtests-serverside  (runs junits needing server started as they
> invoke remote interfaces)
>            pom.xml (surefire:test)
>     + runtests-incontainer-tests
>            pom.xml (antrun for running JUnitEE or Cactus incontainer
> tests)
>     + stop-container
>            pom.xml (antrun or cargo)
> 
> All plugins above bound to the integration-test phase
> 
> I found this approach also necessary, because you can only have one
> instance
> of the antRun plugin for the integration-test phase, therefore you can't
> use
> antrun, then surefire, then antrun again  as the last antrun overrides the
> first if they are bound to the same phase.
> 
> I did want to use Cargo, but unfortunately there was no support for OC4J
> with an existing configuration.
> 
> I have the above 'runtests-integration' suite only execute if the M2 build
> profile is set to -Pintegrationtests. In this way developers can run a
> regular M2 build which just runs standalone JUnits, or specify the profile
> to run a fuller build. We have CruiseControl always running the
> integrations
> tests profile.
> 
> With m2.02 I should now convert the Antruns to Ant Plugins.
> 
> I'm hoping that when M2 supports integration tests more I can migrate to
> the
> approved strategy, but this works right now, we have Applications (both
> EARs) that are built with M2 via CruiseControl, the above integration
> projects start the container run all the integration tests (with the 2nd
> EAR
> application even invoking the 1st EAR's services)
> 
> I have two other M2 modules in addition to those shown above that actually
> hold the integration tests :-
> 
> + tests-serverside
>       pom.xml   (JAR pom, building those JUnits needing server started as
> they invoke remote interfaces)
> + tests-incontainer
>      pom.xml  (JAR pom, building those JUnits needing to run inside
> container JUnitEE or cactus)
> 
> Pete
> 
> 
> On 10/01/06, Bengt-Erik Fröberg <Be...@ki.se> wrote:
> >
> > OK, kinda' weird actually... is it a hard task to extend this surefire
> > plugin to support different kinds of tests?
> >
> > It would be great if you were able to define your own set of directories
> > with tests of different types and to optionally bind each directory to a
> > custom phase.
> > Maybe a <tests>-tag in the POM?
> > I saw there is already a discussion on these matters in the link you
> > submitted. That's great!
> >
> > Regards,
> >
> > /B-E
> >
> >
> >
> > -----Ursprungligt meddelande-----
> > Från: Vincent Massol [mailto:vmassol@pivolis.com]
> > Skickat: den 10 januari 2006 16:38
> > Till: 'Maven Users List'
> > Ämne: RE: How to bind execution of integration tests to integration-test
> > phase
> >
> >
> >
> > > -----Original Message-----
> > > From: Bengt-Erik Fröberg [mailto:Bengt-Erik.Froberg@ki.se]
> > > Sent: mardi 10 janvier 2006 16:28
> > > To: 'Maven Users List'
> > > Subject: SV: How to bind execution of integration tests to
> integration-
> > > test phase
> > >
> > > Hi and thanks for answering.
> > >
> > > I see.... but what does the integration-test phase actually do today
> > then?
> >
> > It's a phase you can bind to. What I'm simply saying is that the
> surefire
> > plugin currently only supports running one type of tests at once.
> >
> > -Vincent
> >
> > > -----Ursprungligt meddelande-----
> > > Från: Vincent Massol [mailto:vmassol@pivolis.com]
> > > Skickat: den 10 januari 2006 16:12
> > > Till: 'Maven Users List'
> > > Ämne: RE: How to bind execution of integration tests to integration-
> test
> > > phase
> > >
> > > Hi,
> > >
> > > > -----Original Message-----
> > > > From: Bengt-Erik Fröberg [mailto:Bengt-Erik.Froberg@ki.se]
> > > > Sent: mardi 10 janvier 2006 14:34
> > > > To: 'Maven Users List'
> > > > Subject: How to bind execution of integration tests to
> > integration-test
> > > > phase
> > > >
> > > >
> > > >
> > > > Hi
> > > >
> > > > I have a set of JUnit unit tests which are executed during the test
> > > > lifecycle phase.
> > > >
> > > > Now I want to add integration-test classes in another directory to
> be
> > > > executed during the integration-test phase.
> > > > How do I accomplish that?
> > > >
> > > > Using  Maven2 and ANT.
> > >
> > > Right now you can't run both unit tests and integration tests in the
> > same
> > > project. We're discussing this and we'll probably modify the surefire
> > > plugin
> > > to allow it.
> > >
> > > See
> > >
> > http://docs.codehaus.org/display/MAVEN/best+practices+-
> +testing+strategies
> > >
> > > Thanks
> > > -Vincent
> > >
> > >
> > >
> > >
> > >
> > >
> > >
> >
> __________________________________________________________________________
> > > _
> > > Nouveau : téléphonez moins cher avec Yahoo! Messenger ! Découvez les
> > > tarifs
> > > exceptionnels pour appeler la France et l'international.
> > > Téléchargez sur http://fr.messenger.yahoo.com
> > >
> > > ---------------------------------------------------------------------
> > > 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
> >
> >
> >
> >
> >
> >
> >
> >
> __________________________________________________________________________
> _
> > Nouveau : téléphonez moins cher avec Yahoo! Messenger ! Découvez les
> > tarifs
> > exceptionnels pour appeler la France et l'international.
> > Téléchargez sur http://fr.messenger.yahoo.com
> >
> > ---------------------------------------------------------------------
> > 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
> >
> >


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