【发布时间】:2016-12-16 21:59:21
【问题描述】:
在 specs2 中,给出了应该满足给定测试套件的实现列表。如何跳过当前环境中不可用的实现,但仍显示一条消息,通知用户已跳过该给定实现的测试?
我试过这个,但是当实现不可用时没有显示消息
case class ImplToTest(name: String, impl: Option[Impl])
val toTest: List[ImplToTest] = ...
val testSuite: Impl => Fragment = ...
toTest.foreach { underTest =>
s"${underTest.name}" >> underTest.map(testSuite).getOrElse(org.specs2.specification.create.DefaultFragmentFactory.text("This implementation is being skipped"))
}
【问题讨论】: