Grails - 在哪里放置测试文件以及如何加载它们 [英] Grails - Where to put test files and how to load them

查看:81
本文介绍了Grails - 在哪里放置测试文件以及如何加载它们的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我想问一下在grails中测试文件的最佳位置(即data.xml)。它是测试/文件夹?



如何轻松加载Integration测试中的测试文件?



谢谢,
Mateo

解决方案

然后,即如果你使用spock进行测试,你可以这样做:

  def mediaBundlerService = Mock(MediaBundlerService)
mediaBundlerService.getPath(_)>> [path:new File('test / integration / resources / test-bundle /')。absolutePath +/]


I'd like to ask where is the best place for test files in grails (i.e. data.xml). Is it test/ folder?

How can I load test files in Integration test easily?

Thanks, Mateo

解决方案

in test/integration/resources

and then, i.e. if you use spock for testing, you can do something like that:

def mediaBundlerService = Mock(MediaBundlerService)
mediaBundlerService.getPath(_) >> [path: new File('test/integration/resources/test-bundle/').absolutePath + "/"]   

这篇关于Grails - 在哪里放置测试文件以及如何加载它们的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆