You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@maven.apache.org by Simon Kitching <sk...@apache.org> on 2006/07/28 00:58:41 UTC
RE: maven-surefire-plugin - turn off for "test", turn on for
"integration-test"?
Hi Chris,
I don't think it's "bending" maven to run two lots of unit tests,
"normal" and "integration".
An <executions> section defines invocations of the specified plugin *in
addition* to the standard one. If you want to skip the standard run, or
restrict the set of classes it runs, then do that inside the
<configuration> section of the plugin main block, not the <executions>
section:
<plugin>
<artifactId>maven-surefire-plugin</artifactId>
...
<configuration><skip>true</skip></configuration>
<executions>
<execution>
...
<skip>false</skip>
Because the additional execution inherits settings from the main one,
you need to reset skip to false in the nested definition. Using excludes
will work in the same manner.
Regards,
Simon
On Thu, 2006-07-27 at 15:52 -0700, Chris Wall wrote:
> Thanks Wendy. Unfortunately svn.apache.org is timing out. I did come
> across one of your earlier posts, so I now understand <executions>
> better. Base on one of your posts, I tried the following w/o success.
>
> <executions>
> <!-- skip unit test run, tests to be executed during integration-test
> -->
> <execution>
> <id>surefire-unit</id>
> <phase>test</phase>
> <goals>
> <goal>test</goal>
> </goals>
> <configuration>
> <excludes>
> <exclude>**/*.java</exclude>
> </excludes>
> <!-- naturally this doesn't work either:
> <skip>true</skip>
> -->
> </configuration>
> </execution>
> <execution>
> <id>surefire-it</id>
> <phase>integration-test</phase>
> <goals>
> <goal>test</goal>
> </goals>
> <configuration>
> <includes>
> <include>**/*.java</include>
> </includes>
> </configuration>
> </execution>
> </executions>
>
> I admit we're bending Maven a bit. Actually, the entire module is a
> test project. ;-)
>
> -Chris
>
> -----Original Message-----
> From: Wendy Smoak [mailto:wsmoak@gmail.com]
> Sent: July 27, 2006 5:23 PM
> To: Maven Users List
> Subject: Re: maven-surefire-plugin - turn off for "test", turn on for
> "integration-test"?
>
> On 7/27/06, Chris Wall <cw...@bea.com> wrote:
>
> > I would like to turn off maven-surefire-plugin during the "test" phase
> > (so, no unit testing at all), and turn on maven-surefire-plugin for
> the
> > "integration-test". Basically my source is a test webapp, and my
> tests
> > are integration tests.
>
> The usual advice is to put your integration tests in a separate
> module, and bind executions of the compiler and surefire to the right
> phases. Here's an example of that:
>
> http://svn.apache.org/repos/asf/struts/struts1/trunk/integration/apps-it
> /pom.xml
> (There are much better examples in the Better Builds with Maven book
> from Mergere.)
>
> Check the archives for some of my recent posts (2-3 months). I got
> some help configuring the Shale Framework examples webapps, where we
> needed to keep the integration tests in the same module as the example
> app and its unit tests.
>
> Here's one of those poms:
> http://svn.apache.org/repos/asf/shale/framework/trunk/shale-apps/shale-b
> lank/pom.xml
>
> Along those lines, for your project, try letting Surefire run during
> 'test', but excluding all of the test classes. Then bind a second
> execution of surefire to the integration-test phase. (Based on the
> Shale example, you might have to explicitly <include> the test
> classes.)
>
> HTH,
---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@maven.apache.org
For additional commands, e-mail: users-help@maven.apache.org
RE: maven-surefire-plugin - turn off for "test", turn on for"integration-test"?
Posted by Chris Wall <cw...@bea.com>.
I sure will. Thanks Wendy.
-----Original Message-----
From: Wendy Smoak [mailto:wsmoak@gmail.com]
Sent: July 27, 2006 8:16 PM
To: Maven Users List
Subject: Re: maven-surefire-plugin - turn off for "test", turn on
for"integration-test"?
On 7/27/06, Chris Wall <cw...@bea.com> wrote:
> Goodness me.
>
> This...
...
> Works!
>
> Thanks everyone!
Would you consider writing up what you've discovered for the wiki?
Here's an 'Examples' page where it might fit:
http://docs.codehaus.org/display/MAVENUSER/Examples
(If by chance you don't have permission to edit, ask on dev@.)
Thanks,
--
Wendy
---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@maven.apache.org
For additional commands, e-mail: users-help@maven.apache.org
_______________________________________________________________________
Notice: This email message, together with any attachments, may contain
information of BEA Systems, Inc., its subsidiaries and affiliated
entities, that may be confidential, proprietary, copyrighted and/or
legally privileged, and is intended solely for the use of the individual
or entity named in this message. If you are not the intended recipient,
and have received this message in error, please immediately return this
by email and then delete it.
---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@maven.apache.org
For additional commands, e-mail: users-help@maven.apache.org
Re: maven-surefire-plugin - turn off for "test", turn on for"integration-test"?
Posted by Wendy Smoak <ws...@gmail.com>.
On 7/27/06, Chris Wall <cw...@bea.com> wrote:
> Goodness me.
>
> This...
...
> Works!
>
> Thanks everyone!
Would you consider writing up what you've discovered for the wiki?
Here's an 'Examples' page where it might fit:
http://docs.codehaus.org/display/MAVENUSER/Examples
(If by chance you don't have permission to edit, ask on dev@.)
Thanks,
--
Wendy
---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@maven.apache.org
For additional commands, e-mail: users-help@maven.apache.org
RE: maven-surefire-plugin - turn off for "test", turn on for"integration-test"?
Posted by Chris Wall <cw...@bea.com>.
Goodness me.
This...
<execution>
<id>surefire-it</id>
<phase>integration-test</phase>
<goals>
<goal>test</goal>
</goals>
<configuration>
<configuration>
<skip>false</skip>
</configuration>
</configuration>
</execution>
...should be (note extra <configuration> stanza)...
<execution>
<id>surefire-it</id>
<phase>integration-test</phase>
<goals>
<goal>test</goal>
</goals>
<configuration>
<skip>false</skip>
</configuration>
</execution>
Works!
Thanks everyone!
-Chris
-----Original Message-----
From: Wendy Smoak [mailto:wsmoak@gmail.com]
Sent: July 27, 2006 6:58 PM
To: Maven Users List
Subject: Re: maven-surefire-plugin - turn off for "test", turn on
for"integration-test"?
On 7/27/06, Chris Wall <cw...@bea.com> wrote:
> Based on your recommendation I made the following update. Yet, the
> execution element's skip=false is not overriding the parent value.
Both
> the unit test and integration test executions are being skipped.
That fits with what I (vaguely) remember happening. I think you
either have to let Surefire run in 'test' and do the
includes/excludes, or else switch to pom packaging and bind executions
of the various plugins exactly where you want them.
--
Wendy
---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@maven.apache.org
For additional commands, e-mail: users-help@maven.apache.org
_______________________________________________________________________
Notice: This email message, together with any attachments, may contain
information of BEA Systems, Inc., its subsidiaries and affiliated
entities, that may be confidential, proprietary, copyrighted and/or
legally privileged, and is intended solely for the use of the individual
or entity named in this message. If you are not the intended recipient,
and have received this message in error, please immediately return this
by email and then delete it.
---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@maven.apache.org
For additional commands, e-mail: users-help@maven.apache.org
Re: maven-surefire-plugin - turn off for "test", turn on for"integration-test"?
Posted by Wendy Smoak <ws...@gmail.com>.
On 7/27/06, Chris Wall <cw...@bea.com> wrote:
> Based on your recommendation I made the following update. Yet, the
> execution element's skip=false is not overriding the parent value. Both
> the unit test and integration test executions are being skipped.
That fits with what I (vaguely) remember happening. I think you
either have to let Surefire run in 'test' and do the
includes/excludes, or else switch to pom packaging and bind executions
of the various plugins exactly where you want them.
--
Wendy
---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@maven.apache.org
For additional commands, e-mail: users-help@maven.apache.org
RE: maven-surefire-plugin - turn off for "test", turn on for"integration-test"?
Posted by Chris Wall <cw...@bea.com>.
Thanks Simon.
Based on your recommendation I made the following update. Yet, the
execution element's skip=false is not overriding the parent value. Both
the unit test and integration test executions are being skipped.
What am I missing? Thanks.
Plugin def:
<!-- skip unit test run, tests to be executed during integration-test
-->
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-surefire-plugin</artifactId>
<configuration>
<skip>true</skip>
</configuration>
<executions>
<execution>
<id>surefire-it</id>
<phase>integration-test</phase>
<goals>
<goal>test</goal>
</goals>
<configuration>
<configuration>
<skip>false</skip>
</configuration>
</configuration>
</execution>
</executions>
</plugin>
Result:
[INFO] Scanning for projects...
[INFO]
------------------------------------------------------------------------
----
[INFO] Building TOM Test WebApp
[INFO] task-segment: [clean, clean, integration-test]
[INFO]
------------------------------------------------------------------------
----
[INFO] [clean:clean]
...
[INFO] [resources:resources]
[INFO] Using default encoding to copy filtered resources.
[INFO] [compiler:compile]
...
[INFO] [resources:testResources]
[INFO] Using default encoding to copy filtered resources.
[INFO] [compiler:testCompile]
...
[INFO] [surefire:test]
[INFO] Tests are skipped.
[INFO] [war:war]
[INFO] Exploding webapp...
...
[INFO] [surefire:test {execution: surefire-it}]
[INFO] Tests are skipped.
[INFO]
------------------------------------------------------------------------
[INFO] BUILD SUCCESSFUL
-Chris
-----Original Message-----
From: Simon Kitching [mailto:skitching@apache.org]
Sent: July 27, 2006 5:59 PM
To: Maven Users List
Subject: RE: maven-surefire-plugin - turn off for "test", turn on
for"integration-test"?
Hi Chris,
I don't think it's "bending" maven to run two lots of unit tests,
"normal" and "integration".
An <executions> section defines invocations of the specified plugin *in
addition* to the standard one. If you want to skip the standard run, or
restrict the set of classes it runs, then do that inside the
<configuration> section of the plugin main block, not the <executions>
section:
<plugin>
<artifactId>maven-surefire-plugin</artifactId>
...
<configuration><skip>true</skip></configuration>
<executions>
<execution>
...
<skip>false</skip>
Because the additional execution inherits settings from the main one,
you need to reset skip to false in the nested definition. Using excludes
will work in the same manner.
Regards,
Simon
On Thu, 2006-07-27 at 15:52 -0700, Chris Wall wrote:
> Thanks Wendy. Unfortunately svn.apache.org is timing out. I did come
> across one of your earlier posts, so I now understand <executions>
> better. Base on one of your posts, I tried the following w/o success.
>
> <executions>
> <!-- skip unit test run, tests to be executed during integration-test
> -->
> <execution>
> <id>surefire-unit</id>
> <phase>test</phase>
> <goals>
> <goal>test</goal>
> </goals>
> <configuration>
> <excludes>
> <exclude>**/*.java</exclude>
> </excludes>
> <!-- naturally this doesn't work either:
> <skip>true</skip>
> -->
> </configuration>
> </execution>
> <execution>
> <id>surefire-it</id>
> <phase>integration-test</phase>
> <goals>
> <goal>test</goal>
> </goals>
> <configuration>
> <includes>
> <include>**/*.java</include>
> </includes>
> </configuration>
> </execution>
> </executions>
>
> I admit we're bending Maven a bit. Actually, the entire module is a
> test project. ;-)
>
> -Chris
>
> -----Original Message-----
> From: Wendy Smoak [mailto:wsmoak@gmail.com]
> Sent: July 27, 2006 5:23 PM
> To: Maven Users List
> Subject: Re: maven-surefire-plugin - turn off for "test", turn on for
> "integration-test"?
>
> On 7/27/06, Chris Wall <cw...@bea.com> wrote:
>
> > I would like to turn off maven-surefire-plugin during the "test"
phase
> > (so, no unit testing at all), and turn on maven-surefire-plugin for
> the
> > "integration-test". Basically my source is a test webapp, and my
> tests
> > are integration tests.
>
> The usual advice is to put your integration tests in a separate
> module, and bind executions of the compiler and surefire to the right
> phases. Here's an example of that:
>
>
http://svn.apache.org/repos/asf/struts/struts1/trunk/integration/apps-it
> /pom.xml
> (There are much better examples in the Better Builds with Maven book
> from Mergere.)
>
> Check the archives for some of my recent posts (2-3 months). I got
> some help configuring the Shale Framework examples webapps, where we
> needed to keep the integration tests in the same module as the example
> app and its unit tests.
>
> Here's one of those poms:
>
http://svn.apache.org/repos/asf/shale/framework/trunk/shale-apps/shale-b
> lank/pom.xml
>
> Along those lines, for your project, try letting Surefire run during
> 'test', but excluding all of the test classes. Then bind a second
> execution of surefire to the integration-test phase. (Based on the
> Shale example, you might have to explicitly <include> the test
> classes.)
>
> HTH,
---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@maven.apache.org
For additional commands, e-mail: users-help@maven.apache.org
_______________________________________________________________________
Notice: This email message, together with any attachments, may contain
information of BEA Systems, Inc., its subsidiaries and affiliated
entities, that may be confidential, proprietary, copyrighted and/or
legally privileged, and is intended solely for the use of the individual
or entity named in this message. If you are not the intended recipient,
and have received this message in error, please immediately return this
by email and then delete it.
---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@maven.apache.org
For additional commands, e-mail: users-help@maven.apache.org