如何使用 @Build 为 grails 集成测试创建多种类型的测试数据
How do I create multiple types of test data for a grails integration test using @Build
第一个域运行良好。但是第二个域不能有 "build" 方法
import grails.test.spock.IntegrationSpec
import grails.buildtestdata.mixin.Build
@Build(Domain1)
@Build(Domain2)
class DomainServiceSpec extends IntergrationSpec {
def "test mock" () {
Domain1.build(a: a, b: b, c: c) //working fine
Domain2.build(a: a, b: b, c: c) //"build" method is not recognized
}
}
@Build([Domain1, Domain2])
我建议你阅读插件文档:Unit Test Support
第一个域运行良好。但是第二个域不能有 "build" 方法
import grails.test.spock.IntegrationSpec
import grails.buildtestdata.mixin.Build
@Build(Domain1)
@Build(Domain2)
class DomainServiceSpec extends IntergrationSpec {
def "test mock" () {
Domain1.build(a: a, b: b, c: c) //working fine
Domain2.build(a: a, b: b, c: c) //"build" method is not recognized
}
}
@Build([Domain1, Domain2])
我建议你阅读插件文档:Unit Test Support