Running a single test with Maven

Posted on 25-05-2013 13:16 by graham
To run a single test in Maven, use the following command:
mvn -Dtest=TestClassName test

You can also name multiple test, separating them with a comma:
mvn -Dtest=TestClassName,SomeOtherTestClass test

Wildcards in test class names are also allowed:
mvn -Dtest=Test*Name test


Add comment

Has this tutorial been helpful to you? Or do you see anything wrong? We appreciate your opinion!
Your comment:
Show formatting hints
HTML is disallowed, but in your text you can use the following markup
  • [code][/code] for a block of code
  • [tt][/tt] for inline code
  • [link]link href|link anchor[/link] for links
  • [b][/b] for bold text
+ Ask a question
If you have a technical question related to programming and computers, ask it here. Other users will help you solve it!
Unanswered questions
Share your knowledge by helping others solve their problems