2
查找斯波克
我只是增加斯波克到一個Grails 2.2.3項目Grails的2.2.3無法在類路徑
我添加以下依賴於Buildonfig.groovy:
plugins { test(":spock:0.7") }
然後創建了規範類,「測試/單元/ LocationSpec.groovy:
import grails.test.mixin.* import org.junit.* import spock.lang.* /** * See the API for {@link grails.test.mixin.support.GrailsUnitTestMixin} for usage instructions */ @TestFor(Location) class LocationSpec extends Specification { def setup() { } def cleanup() { } def "compare"() { when: def loc1 = new Location(description:descr1) def loc2 = new Location(description:descr2) then: loc1.compareTo(loc2) == descr1.compareTo(descr2) where: descr1 | descr2 | pidm1 | pidm2 "foo" | "foo" | 1333868 | 1333868 } }
但是我收到以下錯誤與規格進口線:
Groovy:unable to resolve class spock.lang.Specification
你有沒有發現,在DOC這點。 – Abs
@Abdullah是的,那正是我找到它的地方。我在答案中引用了這些文檔,然後對自己進行了一些探索,以便不遵循古老的建議:R.T.F.M(閱讀精細手冊):) – 10GritSandpaper