2015-07-28 16 views
2
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與SpecWithJUnit

回答

2

您需要添加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") 
    } 
} 
+0

是的,這工作。有沒有解釋這個問題的文件? – BritishDan

+1

'PendingUntilFixed'是[there](https://etorreborre.github.io/specs2/guide/SPECS2-3.6.3/org.specs2.guide.PendingUntilFixedExamples.html)和「輕量級規格」在這裏描述[這裏]( https://etorreborre.github.io/specs2/guide/SPECS2-3.6.3/org.specs2.guide.LightweightSpecs.html)。另一方面,文檔沒有提到你必須在輕量級規格中添加PendingUntilFixed特性。 – Eric

相關問題