import org.specs2.mutable.SpecWithJUnit
import org.specs2.specification.Scope
import org.specs2.execute.Failure
class MyTest extends SpecWithJUnit {
  trait Context extends Scope
  "myClass" should {
    "work but not right now" in new Context {
       Failure("test fails")
    }
  }
}


在此Specs2示例中,如何将测试标记为未决,直到修复(就像我对SpecificationWithJUnit所做的一样)?

最佳答案

您需要添加PendingUntilFixed特征:

import org.specs2.mutable.SpecWithJUnit
import org.specs2.specification.Scope
import org.specs2.execute.{PendingUntilFixed, Failure}

class TestSpec extends SpecWithJUnit with PendingUntilFixed {
  trait Context extends Scope
  "myClass" should {
    "work but not right now" in new Context {
      failure("test fails")
    }.pendingUntilFixed("for now")
  }
}

关于scala - 如何使用SpecWithJUnit将测试标记为未决,我们在Stack Overflow上找到一个类似的问题:https://stackoverflow.com/questions/31671810/

10-10 19:12