Search code examples
scalamavenscalatest

How to run a single test in scalatest from maven


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

Solution

  • 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