Nevermind, after 30 seconds of thought I answered my own question:

        <profile>
            <id>package.test</id>
            <activation>
                <property>
                    <name>test.package</name>
                </property>
            </activation>
            <build>
                <plugins>
                    <plugin>
                        <groupId>org.apache.maven.plugins</groupId>
                        <artifactId>maven-surefire-plugin</artifactId>
                        <configuration>
                            <includes>
<include>com/**/${test.package}/**/ *Test.java</include>
                            </includes>
                        </configuration>
                    </plugin>
                </plugins>
           </build>
        </profile>

By the way, here's a perfect example of why maven needs a help tool. All these sorts of profiles are project specific, and much of the help for them could be automatically extracted. For example, Maven could tell the user the test.package parameter modifies the configuration of the surefire plugin, and perhaps could even pull the description of the includes parameter from the surefire pom?

-Josh


On Mar 23, 2008, at 9:45 PM, Joshua ChaitinPollak wrote:

Hi,

I'd like to filter the unit tests that surefire will run by using the includes parameter on the command line. With our ant build system, developers can do:

ant -Dpackage=rm test-match

and it will set a fileset like this "com/**/${package}/**/ *Test.java" to limit the tests to be run to that package.

Is there a way to do this in Maven? I know that if you want to run a specific unit test, you can call maven like this:

mvn -Dtest=$TEST test

And I know there is a surefire configuration option called 'includes' that lets you set a path or file group but how can I test an 'includes' on the command line?

--
Joshua ChaitinPollak | Software Engineer
Kiva Systems, Inc., 225 Wildwood Ave, Woburn, MA 01970







--
Joshua ChaitinPollak | Software Engineer
Kiva Systems, Inc., 225 Wildwood Ave, Woburn, MA 01970






Reply via email to