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:[EMAIL PROTECTED] 
> 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 <[EMAIL PROTECTED]> 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: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]

Reply via email to