Friday 22 April 2011

Maven: run only a JUnit test

Run a JUnit test class

//this is a Spring Test - it can be any JUnit test
@RunWith(SpringJUnit4ClassRunner.class)
public class FooTest {

@Test
public void foo1() {
//...
}
$ mvn -Dtest="FooTest" test

Run a JUnit test class method

$ mvn -Dtest=FooTest#foo1 test

References

http://maven.apache.org/plugins/maven-surefire-plugin/examples/single-test.html

No comments:

Post a Comment