可以使用ex
参数从SBT运行一个具体的例子:
sbt> test-only *FooSpec* -- ex bar
您也可以混合在org.specs2.mutable.Tags
特征并包括特定标签:
sbt> test-only *FooSpec* -- include investigate
class FooSpec extends Specification with Tags {
"foo" should {
tag("investigate")
"bar" in {
// ...
}
"baz" in {
// ...
}
}
}
你也可以只是重新运行先前失败的例子,不管他们是
sbt> test-only *FooSpec* -- was x
最后,在未来的2.0版本(或使用最新的1.15-SNAPSHOT),您将能够创建一个script.Specification
并使用“自动编号例如组”:
import specification._
/**
* This kind of specification has a strict separation between the text
* and the example code
*/
class FooSpec extends script.Specification with Groups { def is = s2"""
This is a specification for FOO
First of all, it must do foo
+ with bar
+ with baz
"""
"foo" - new group {
eg := "bar" must beOk
eg := "baz" must beOk
}
}
// execute all the examples in the first group
sbt> test-only *FooSpec* -- include g1
// execute the first example in the first group
sbt> test-only *FooSpec* -- include g1.e1
但是没有办法来指定,具有可变的规范,要运行示例"foo"/"bar"
。这可能是未来添加的功能。
在scala IDE中如何做? – zinking 2014-05-01 01:52:43