如何在包装函数中执行 spec2 规范的所有测试?
前任:
class HelloWorldSpec extends Specification {
wrapAll(example) = {
// wrap it in a session, for example.
with(someSession){
example()
}
}
"The 'Hello world' string" should {
"contain 11 characters" in {
"Hello world" must have size(11)
}
"start with 'Hello'" in {
"Hello world" must startWith("Hello")
}
"end with 'world'" in {
"Hello world" must endWith("world")
}
}
}
因此,这 3 个测试中的每一个都应该在
与(一些会话){...
使用 ScalaTest 时,我可以用Fixture覆盖