有时我们需要在测试用例中混合一些特征。但是,以下操作不起作用:
"abc" should {
"def" in new TraitA with TraitAB {
// ...
}
}为了使其正常工作,我们执行以下操作:
trait Fixture extends Before {
def before = ()
}
"abc" should {
"def" in new Fixture with TraitA with TraitAB {
// ...
}
}这感觉有点老生常谈。有没有更好的方法呢?
发布于 2013-04-29 14:19:34
如果您还混合了org.specs2.specification.Scope标记特征,这将会起作用:
"abc" should {
"def" in test {
// ...
}
}
trait test extends TraitA with TraitAB with Scopehttps://stackoverflow.com/questions/16271911
复制相似问题