Warning: file_get_contents(/data/phpspider/zhask/data//catemap/2/scala/17.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Scala sbt测试仅适用于特定测试_Scala_Sbt - Fatal编程技术网

Scala sbt测试仅适用于特定测试

Scala sbt测试仅适用于特定测试,scala,sbt,Scala,Sbt,我有几个测试分布在几个班级 我只想运行第一个类的第一个测试: 课程为: class Step1_PrimarySpec 测试是: test("case1: Primary (in isolation) should properly register itself to the provided Arbiter") 我试过: sbt test-only Step1_PrimarySpec 以及: 以及: 以及: 但是,所有这些命令都运行整个测试套件 那么我如何才能只运行那个特定的测试

我有几个测试分布在几个班级

我只想运行第一个类的第一个测试:

课程为:

class Step1_PrimarySpec 
测试是:

  test("case1: Primary (in isolation) should properly register itself to the provided Arbiter")
我试过:

sbt test-only Step1_PrimarySpec
以及:

以及:

以及:

但是,所有这些命令都运行整个测试套件


那么我如何才能只运行那个特定的测试呢?

您必须在整个命令周围加上双引号,如下所示:

sbt "test-only <test-name>"
sbt“仅测试”
根据答案,您应该将其设置为
testOnly
,并使用
-z
参数

sbt "testOnly *Step1_PrimarySpec -- -z mytest"
它将从名为
Step1\u PrimarySpec
的类(而不是文件)中运行名为mytest的测试

通过使用
*
,测试运行程序可以避免我们指定其完全限定的类名。i、 e.org.path.to.Step1_PrimarySpec

sbt“仅测试org.path.to.test.testClassName”
 sbt test-only "*Step1_PrimarySpec"
sbt "test-only <test-name>"
sbt "testOnly *Step1_PrimarySpec -- -z mytest"