我正在为我的specs2软件编写一个scala单元测试。执行过程运行良好。我唯一的问题是,我需要在所有测试完成后进行清理。我就是找不到任何解决方案。有没有办法在所有测试结束后执行某些函数?
发布于 2012-11-27 05:06:12
您需要在规范的末尾添加一个Step:
import org.specs2.mutable._
class MySpec extends Specification {
// lots of examples here
// cleanup there
step(cleanUp())
}发布于 2012-11-26 23:58:39
您可以尝试在with After之后使用,并实现def after函数。
示例:
class Context extends Specification {
....
}
trait trees extends mutable.After {
def after = cleanupDB
}https://stackoverflow.com/questions/13567431
复制相似问题