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_PrimarySpecsbt“仅测试org.path.to.test.testClassName”
sbt test-only "*Step1_PrimarySpec"
sbt "test-only <test-name>"
sbt "testOnly *Step1_PrimarySpec -- -z mytest"