Parallel execution of tests

前端 未结 5 500
孤独总比滥情好
孤独总比滥情好 2021-01-01 12:20

I\'ve noticed that SBT is running my specs2 tests in parallel. This seems good, except one of my tests involves reading and writing from a file and hence fails unpredictabl

5条回答
  •  轮回少年
    2021-01-01 12:53

    In addition to that is written about sbt above, you must know that specs2 runs all the examples of your specifications concurrently by default.

    You can still declare that, for a given specification, the examples must be executed sequentially. To do that, you simply add sequential to the beginning of your specification:

    class WriteAndReadSpec extends Specification{
      val file = new File("testFiles/tmp.txt")
    
      sequential
    
      "WriteAndRead" should {
       ...
      }
    }
    

提交回复
热议问题