Fork me on GitHub

Running a Single Test

During development, you may run a single test class repeatedly. To run this through Maven, set the it.test property to a specific test case.

mvn -Dit.test=ITCircle verify

The value for the it.test parameter is the name of the test class (without the extension; we'll strip off the extension if you accidentally provide one).

You may also use patterns to run a number of tests:

mvn -Dit.test=ITCi*le verify

And you may use multiple names/patterns, separated by commas:

mvn -Dit.test=ITSquare,ITCi*le verify

Running a Set of Methods in a Single Test Class

As of Surefire 2.7.3, you can also run only a subset of the tests in a test class.

NOTE : This feature is supported only for Junit 4.x and TestNG.

You must use the following syntax:

mvn -Dit.test=ITCircle#mytest verify

You can use patterns too

mvn -Dit.test=ITCircle#test* verify

As of Surefire 2.12.1, you can select multiple methods (JUnit 4.x only at this time; patches welcome!):

mvn -Dit.test=ITCircle#testOne+testTwo verify