You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@maven.apache.org by Bryan Young <sc...@gmail.com> on 2008/08/27 16:33:32 UTC

Disabling acceptance tests from the command line

I would like to build my project skipping my acceptance tests, but still run
my unit tests.  This seems simple enough if I alter the includes/excludes
for the surefire plugin, but I want to make this decision at the command
line.  Essentially what I want is a property like this:
-Dmaven.acceptance.test.skip=true  which still runs my regular unit tests.



I've spent quite a bit of time researching this, but I'm pretty new to
Maven, so I haven't had much luck.  Any direction would be appreciated.



Thanks



Bryan



In case it helps, a little background:  My goal is to have two build
configurations in our continous integration system (Team City, in our case).
The first build is quick and runs on any checkin.  It will compile and run
the unit tests.  The second takes MUCH longer, but runs all the clover
coverage, acceptance tests, etc, but only runs twice a day (because it takes
so damn long).

Re: Disabling acceptance tests from the command line

Posted by Bryan Young <Br...@scruffles.net>.
Thanks. This is exactly the information I was looking for.  The link Wendy
sent me had a fairly
good example of this, but I think I needed the extra explanation.



On Wed, Aug 27, 2008 at 1:17 PM, Mohit Manrai <ma...@gmail.com> wrote:

>
> Hey,
>
> I think you can rename your acceptance tests with some thing like
> *AcceptenceTest*.java and then create different profiles for build with and
> without acceptence test. See <profiles> in maven documentation. Probably
> while running normal build you will like to exclude
> **/*AcceptenceTest*.java
> files
>
> Say you create a profile named "acceptencetest"
> Say you create a profile named "dev"
>
> From command line you can use mvn clean install -Dacceptencetest  : this
> will run full build along with acceptence tests
>
> if you use mvn clean install -Ddev : it will skip acceptence as you will
> mention excludes in this profile.
>
> I hope i am understanding your problem correctly.
>
>
>
>
>
>
>
> Bryan Young-4 wrote:
> >
> > That's disappointing to hear.  I would imagine separating
> > integration/acceptance tests is a fairly common
> > issue.
> >
> > Altering the layout of the source tree isn't really an option for me (big
> > corporate environment).
> >
> > The link you sent had an interesting idea.  If I exclude the Acceptance
> > Tests from the test phase and include
> > only the Acceptance Tests in the integration test phase, I think that
> > would
> > give me the results I want.  There
> > was an example POM, but no example of how to use it.
> >
> > Running the POM from the example seems to run the UTs, but not the ATs.
> > How
> > would I explicitly run the
> > integration test phase using that POM?
> >
> > Thanks for the help
> >
> > Bryan
> >
> > On Wed, Aug 27, 2008 at 9:39 AM, Wendy Smoak <ws...@gmail.com> wrote:
> >
> >> On Wed, Aug 27, 2008 at 7:33 AM, Bryan Young <sc...@gmail.com>
> wrote:
> >> > I would like to build my project skipping my acceptance tests, but
> >> still
> >> run
> >> > my unit tests.  This seems simple enough if I alter the
> >> includes/excludes
> >> > for the surefire plugin, but I want to make this decision at the
> >> command
> >> > line.  Essentially what I want is a property like this:
> >> > -Dmaven.acceptance.test.skip=true  which still runs my regular unit
> >> tests.
> >>
> >> Unless someone has fixed this while I wasn't looking, which happens
> >> occasionally, the base problem is that Maven doesn't have good support
> >> for integration/acceptance tests-- there is only *one*
> >> testSourceDirectory so you have to jump through hoops with
> >> includes/excludes and extra surefire executions to make it work.
> >>
> >> The best bet is to move the acceptance tests to a separate module.
> >> Then you can use a profile to selectively enable or disable it.
> >>
> >> There is some info on the wiki:
> >>
> http://docs.codehaus.org/display/MAVENUSER/Maven+and+Integration+Testing
> >>
> >> --
> >> Wendy
> >>
> >> ---------------------------------------------------------------------
> >> To unsubscribe, e-mail: users-unsubscribe@maven.apache.org
> >> For additional commands, e-mail: users-help@maven.apache.org
> >>
> >>
> >
> >
>
> --
> View this message in context:
> http://www.nabble.com/Disabling-acceptance-tests-from-the-command-line-tp19182310p19186714.html
> Sent from the Maven - Users mailing list archive at Nabble.com.
>
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: users-unsubscribe@maven.apache.org
> For additional commands, e-mail: users-help@maven.apache.org
>
>

Re: Disabling acceptance tests from the command line

Posted by Mohit Manrai <ma...@gmail.com>.
Hey,

I think you can rename your acceptance tests with some thing like
*AcceptenceTest*.java and then create different profiles for build with and
without acceptence test. See <profiles> in maven documentation. Probably
while running normal build you will like to exclude **/*AcceptenceTest*.java
files 

Say you create a profile named "acceptencetest"
Say you create a profile named "dev"

>From command line you can use mvn clean install -Dacceptencetest  : this
will run full build along with acceptence tests

if you use mvn clean install -Ddev : it will skip acceptence as you will
mention excludes in this profile.

I hope i am understanding your problem correctly.







Bryan Young-4 wrote:
> 
> That's disappointing to hear.  I would imagine separating
> integration/acceptance tests is a fairly common
> issue.
> 
> Altering the layout of the source tree isn't really an option for me (big
> corporate environment).
> 
> The link you sent had an interesting idea.  If I exclude the Acceptance
> Tests from the test phase and include
> only the Acceptance Tests in the integration test phase, I think that
> would
> give me the results I want.  There
> was an example POM, but no example of how to use it.
> 
> Running the POM from the example seems to run the UTs, but not the ATs. 
> How
> would I explicitly run the
> integration test phase using that POM?
> 
> Thanks for the help
> 
> Bryan
> 
> On Wed, Aug 27, 2008 at 9:39 AM, Wendy Smoak <ws...@gmail.com> wrote:
> 
>> On Wed, Aug 27, 2008 at 7:33 AM, Bryan Young <sc...@gmail.com> wrote:
>> > I would like to build my project skipping my acceptance tests, but
>> still
>> run
>> > my unit tests.  This seems simple enough if I alter the
>> includes/excludes
>> > for the surefire plugin, but I want to make this decision at the
>> command
>> > line.  Essentially what I want is a property like this:
>> > -Dmaven.acceptance.test.skip=true  which still runs my regular unit
>> tests.
>>
>> Unless someone has fixed this while I wasn't looking, which happens
>> occasionally, the base problem is that Maven doesn't have good support
>> for integration/acceptance tests-- there is only *one*
>> testSourceDirectory so you have to jump through hoops with
>> includes/excludes and extra surefire executions to make it work.
>>
>> The best bet is to move the acceptance tests to a separate module.
>> Then you can use a profile to selectively enable or disable it.
>>
>> There is some info on the wiki:
>> http://docs.codehaus.org/display/MAVENUSER/Maven+and+Integration+Testing
>>
>> --
>> Wendy
>>
>> ---------------------------------------------------------------------
>> To unsubscribe, e-mail: users-unsubscribe@maven.apache.org
>> For additional commands, e-mail: users-help@maven.apache.org
>>
>>
> 
> 

-- 
View this message in context: http://www.nabble.com/Disabling-acceptance-tests-from-the-command-line-tp19182310p19186714.html
Sent from the Maven - Users mailing list archive at Nabble.com.


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


Re: Disabling acceptance tests from the command line

Posted by Bryan Young <sc...@gmail.com>.
That's disappointing to hear.  I would imagine separating
integration/acceptance tests is a fairly common
issue.

Altering the layout of the source tree isn't really an option for me (big
corporate environment).

The link you sent had an interesting idea.  If I exclude the Acceptance
Tests from the test phase and include
only the Acceptance Tests in the integration test phase, I think that would
give me the results I want.  There
was an example POM, but no example of how to use it.

Running the POM from the example seems to run the UTs, but not the ATs.  How
would I explicitly run the
integration test phase using that POM?

Thanks for the help

Bryan

On Wed, Aug 27, 2008 at 9:39 AM, Wendy Smoak <ws...@gmail.com> wrote:

> On Wed, Aug 27, 2008 at 7:33 AM, Bryan Young <sc...@gmail.com> wrote:
> > I would like to build my project skipping my acceptance tests, but still
> run
> > my unit tests.  This seems simple enough if I alter the includes/excludes
> > for the surefire plugin, but I want to make this decision at the command
> > line.  Essentially what I want is a property like this:
> > -Dmaven.acceptance.test.skip=true  which still runs my regular unit
> tests.
>
> Unless someone has fixed this while I wasn't looking, which happens
> occasionally, the base problem is that Maven doesn't have good support
> for integration/acceptance tests-- there is only *one*
> testSourceDirectory so you have to jump through hoops with
> includes/excludes and extra surefire executions to make it work.
>
> The best bet is to move the acceptance tests to a separate module.
> Then you can use a profile to selectively enable or disable it.
>
> There is some info on the wiki:
> http://docs.codehaus.org/display/MAVENUSER/Maven+and+Integration+Testing
>
> --
> Wendy
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: users-unsubscribe@maven.apache.org
> For additional commands, e-mail: users-help@maven.apache.org
>
>

Re: Disabling acceptance tests from the command line

Posted by Wendy Smoak <ws...@gmail.com>.
On Wed, Aug 27, 2008 at 7:33 AM, Bryan Young <sc...@gmail.com> wrote:
> I would like to build my project skipping my acceptance tests, but still run
> my unit tests.  This seems simple enough if I alter the includes/excludes
> for the surefire plugin, but I want to make this decision at the command
> line.  Essentially what I want is a property like this:
> -Dmaven.acceptance.test.skip=true  which still runs my regular unit tests.

Unless someone has fixed this while I wasn't looking, which happens
occasionally, the base problem is that Maven doesn't have good support
for integration/acceptance tests-- there is only *one*
testSourceDirectory so you have to jump through hoops with
includes/excludes and extra surefire executions to make it work.

The best bet is to move the acceptance tests to a separate module.
Then you can use a profile to selectively enable or disable it.

There is some info on the wiki:
http://docs.codehaus.org/display/MAVENUSER/Maven+and+Integration+Testing

-- 
Wendy

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