How to run a single test in scalatest from maven

StephenBoesch picture StephenBoesch · Jul 20, 2014 · Viewed 12.7k times · Source

I have not found any documentation on how to do this. For JUnit the equivalent would be:

mvn -Dtest=org.apache.spark.streaming.InputStreamSuite test

Answer

user1132007 picture user1132007 · Feb 17, 2016

tl;dr mvn test -Dsuites="some.package.SpecsClass"


I found an answer from here and it works:(https://groups.google.com/forum/#!topic/scalatest-users/Rr0gy61dg-0)

run test 'a pending test' in HelloSuite, and all tests in HelloWordSpec:

 mvn test -Dsuites='org.example.
HelloSuite @a pending test, org.example.HelloWordSpec' 
  • run all tests in HelloSuite containing 'hello':

    mvn test -Dsuites='org.example.HelloSuite hello'

for more details: http://scalatest.org/user_guide/using_the_scalatest_maven_plugin