Maven tips and Tricks: running a subset of tests

So, you wanna run only some of your tests because they take too
long? check this as a sample to avoid running dao tests (provided that
you use some naming convention, as calling them *Dao*Test):

    <!-- test configurations -->
    <goal name="test:notdao">
        <j:set var="testmatchpattern" value="**/*Test.*"/>
        <j:set var="testnotmatchpattern" value="**/Abstract*,**/*Dao*Test.*"/>
        <attainGoal name="test:match"/>
    </goal>

The only drawback is that you need the latest maven test plugin (1.7). You can just add this dependency to your project.xml.

        <dependency>
            <groupId>maven</groupId>
            <artifactId>maven-test-plugin</artifactId>
            <version>1.7</version>
            <type>plugin</type>
        </dependency>

2 thoughts on “Maven tips and Tricks: running a subset of tests

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

Connecting to %s