Sudheer Aedama
Sudheer Aedama

Reputation: 2144

How to run tests in a class sequentially in ScalaTest?

I have a class which extends org.scalatest.junit.JUnitSuite. This class has a couple of tests. I do not want these tests to run in parallel.

I know how simple it is with Specs2 (extend the class with Specification and add a single line sequential inside the class) as shown here: How to run specifications sequentially.

I do not want to alter the Build file by setting: parallelExecution in Test := false nor I want to use tags to run specific test files sequentially.

All I want is a way to make sure that all tests inside my class run sequentially. Is this possible with ScalaTest ? Any sample test/template is appreciated.

A quick google search pointed me to this: http://doc.scalatest.org/2.0/index.html#org.scalatest.Sequential

Just for the couple of tests I have, I think it is a total overkill to create StepSuites. I am not completely sure if that's the way to go about with my case!

Upvotes: 9

Views: 14032

Answers (1)

Joe Pallas
Joe Pallas

Reputation: 2155

The doc for org.scalatest.ParallelTestExecution says

ScalaTest's normal approach for running suites of tests in parallel is to run different suites in parallel, but the tests of any one suite sequentially.

So it looks like you don't have to do anything to get what you want, if your tests are in a single suite.

Upvotes: 22

Related Questions