scala - 如何使用 SpecWithJUnit 将测试标记为 pendingUntilFixed

标签 scala testing tdd specs2

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 将测试标记为 pendingUntilFixed,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/31671810/

相关文章:

Scala:包含类型的变量

scala - 如何完成 Akka Flow 测试?

reactjs - 使用动态导入测试 React 组件 (Enzyme/Mocha)

android - 测试驱动开发::AndroidStudio + Robolectric(Can not resolve symbol error for junit and Robolectric imports)

unit-testing - 开发源代码的 TDD 方法

c++ - 如何有效地针对 Windows API 进行测试?

scala - LiftWeb 框架 - 覆盖 LiftRules.sessionInactivityTimeout

包含 Map 的 Scala 协变类(不变量中的键)

scala - Scala 中 AnyVal 类型(Int、Double 等)的 +=/*=/etc 运算符

python - 如何禁用 pytest.ini 中的多个插件?