如何在ScalaTest中按顺序在类中运行测试?

问题描述:

我有一个扩展org.scalatest.junit.JUnitSuite的类.本课程有一些测试.我不希望这些测试并行运行.

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.

我知道Specs2有多么简单(用Specification扩展类,并在类内添加一行sequential),如下所示:

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.

我不想通过设置来更改Build文件: parallelExecution in Test := false 我也不想使用标签按顺序运行特定的测试文件.

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.

我想要的是一种确保班级内的所有测试顺序运行的方式. ScalaTest有可能吗?任何示例测试/模板都值得赞赏.

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.

一个快速的Google搜索使我注意到了这一点: http://doc.scalatest.org/2.0/index.html#org.scalatest.Sequential

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

就我所进行的几次测试而言,我认为创建StepSuite完全是过头了.我不完全确定这是否适合我的案子!

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!