Hello,
unit tests we just put in src/test/java instead of src/main/java and
surefire runs them automatically in phase "test". You can do a "mvn
test" on the command-line to run only up to and including these tests.
Integration tests - here's an example (that you can also adapt for unit
tests)
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-surefire-plugin</artifactId>
<executions>
<execution>
<id>integration-tests</id>
<phase>integration-test</phase>
<goals>
<goal>test</goal>
</goals>
<configuration>
<includes>
<param>**/*IntegrationTest.java</param>
</includes>
</configuration>
</execution>
</executions>
</plugin>
They'll be run in the regular build in phase integration-test. If you
don't want them to run automatically, you can put this in a <profile>
section and then you'd start them with "mvn -P profilename
integration-test".
Yours,
David
> -----Original Message-----
> From: Campano, Troy [mailto:[EMAIL PROTECTED]
> Sent: 30 April 2008 02:14
> To: [email protected]
> Subject: Execute Integration/Unit Tests Separately
>
>
> Hello,
> I am new to Maven 2 (trying to convert from Maven 1). I want
> to be able
> to run my Unit Tests and Integration Tests separately. I have named my
> unit tests **UnitTest.java and my integration tests
> **IntegrationTest.java. In Maven 1 I would define two custom goals in
> maven.xml, one for each type of test, and also define the "include"
> filter to include the correct tests in the corresponding custom goal
> (the "test-unit" goal would run all my **UnitTest.java files and
> "test-integration" would run all of my **IntegrationTest.java files).
>
> How do I do this with Maven 2? I just read through the whole
> "lifecycle"
> concept. Does this mean I would define the SureFire plugin to
> run in the
> "test" phase and the "integration-test" phase and each
> definition in my
> pom.xml would be tied to one of those lifecycle phases (each
> with their
> own separate "include" definition)?
>
> Thank you for the help, it's appreciated!
>
> ~ T r o y ~
>
---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]