There are two ways actually to tell surefire which tests to run. Chris already provided one: using includes/excudes which requires that you edit your pom.xml.

Another way, which I use when I am editing a single test class is using -Dtest=<class name> in cli.

Please see: http://maven.apache.org/plugins/maven-surefire-plugin/test-mojo.html#test


^_^


Chris Hilton wrote:
We do something similar here with a profile:

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

Then we can invoke "mvn -Ptest-name
-Dtest.name=com/example/SomeClassTest test". We have a similar profile
for testing an entire package. Hope that gives you some ideas.

Chris

-----Original Message-----
From: Lisa [mailto:[EMAIL PROTECTED] Sent: Tuesday, 23 January, 2007 13:13
To: users@maven.apache.org
Subject: mvn test - how to invoke a specific class from command line


Is there a way to create a pom.xml file that will run only tests in one class from the command line?

I want to type:
   mvn <target>

Where <target> can be any word I choose and have it execute all tests in a specific class only. there may be many, many classes in the test directories, I only want it to execute one single class, or possibly several classes in sequence, but I want to choose which ones.

Any help would be greatly appreciated.

Lisa
--
View this message in context: http://www.nabble.com/mvn-test---how-to-invoke-a-specific-clas
s-from-command-line-tf3066182s177.html#a8528263
Sent from the Maven - Users mailing list archive at Nabble.com.


---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]



---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]



---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]

Reply via email to