Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How do you run only a single Spec2 specification with SBT?

Tags:

scala

specs2

If you have 2 tests defined in your SBT project:

class Spec1 extends Specification {
  def is =
    "Tests for specification 1" ^
      p ^
      "Test case 1" ! todo ^
      end
}

and

class Spec2 extends Specification {
  def is =
    "Tests for specification 2" ^
      p ^
      "Test case 2" ! todo ^
      end
}

Then running test from inside SBT will execute both these tests. What is the simplest way to run only one of these tests?

like image 235
Jack Avatar asked Dec 10 '12 09:12

Jack


1 Answers

Use the test-only sbt command.

sbt> test-only com.example.MySpec

You can even use a wildcard to run a range of tests. See How to execute tests that match a regular expression only?

like image 120
Régis Jean-Gilles Avatar answered Oct 23 '22 10:10

Régis Jean-Gilles