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


I found an answer from here and it works:(!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:

Found the answer: it is


So here is the example command line:

mvn -pl streaming -DwildcardSuites=org.apache.spark.streaming.InputStreamSuite test

Update Newer versions of scalatest use


So the syntax would be:

mvn -pl streaming -Dsuites=org.apache.spark.streaming.InputStreamSuite test

Note that if you have some Java tests in the same module, as much of spark does, you need to turn them off -which you can do by telling surefire to run a test that isn't there

Here is the test that I've just been running

mvn test -Dtest=moo -DwildcardSuites=org.apache.spark.deploy.yarn.ClientSuite

That skips the java test and only runs the scala one.

One thing which scalatest doesn't seem to do is let you run a single test within a suite, the way maven surefire does. That's not ideal if you have one failing test in a big suite.

[Correction 2016-08-22: looks like you can ask for a specific suite by name; look at the other answers below. Happy to be wrong].

Need Your Help

How to get the current port number in Flask?

python networking web-frameworks flask

Using Flask, how can I get the current port number that flask is connected to? I want to start a server on a random port using port 0 but I also need to know which port I am on.

How to create a UITableViewCell with a transparent background

iphone cocoa-touch uitableview

I'm trying to set the background color of a UITableViewCell to transparent. But nothing seems to work. I have some images/buttons inside the tableViewCell and I would like to make the white