【问题标题】:How do I create multiple types of test data for a grails integration test using @Build如何使用 @Build 为 grails 集成测试创建多种类型的测试数据
【发布时间】:2017-07-28 17:49:39
【问题描述】:

第一个域运行良好。但是第二个域不能有“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
    }
}

【问题讨论】:

    标签: grails integration-testing grails-orm h2


    【解决方案1】:
    @Build([Domain1, Domain2])
    

    我建议你阅读插件文档:Unit Test Support

    【讨论】:

      猜你喜欢
      • 2018-10-18
      • 2015-02-10
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 2019-04-23
      • 1970-01-01
      • 2019-03-26
      • 2013-07-11
      相关资源
      最近更新 更多