9

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!

Community
  • 1
  • 1
Sudheer Aedama
  • 2,116
  • 2
  • 21
  • 39

1 Answers1

21

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.

Joe Pallas
  • 2,105
  • 1
  • 14
  • 17
  • 2
    In my tests, the tests need to instantiate a database which is causing port conflict. Is there a way to run suites sequentially? – Manu Chadha Sep 17 '20 at 05:58