【发布时间】:2014-10-28 07:51:02
【问题描述】:
我正在处理使用jasper 生成pdf 的操作的集成测试用例。碧玉有一个sub-report。要获取子报告的路径(web-app/reports/ 中的abc.jasper),我首先使用获取真实路径
request.getSession().getServletContext().getRealPath("")
它给出/home/mkb/workspace/my-project/web-app,然后连接/reports/abc.jasper 以获取父jasper 报告中的子报告。这在运行应用程序 (run-app) 时工作正常。
但是在测试(test-app)上面的代码时给出/home/mkb/workspace/my-project/target/work/scriptCache,因此我得到了
net.sf.jasperreports.engine.JRException: Resource not found at :
/home/mkb/workspace/my-project/target/work/scriptCache/reports/abc.jasper
如何在测试用例中设置或修复此路径问题?(Grails 2.3.9)
【问题讨论】:
标签: grails testing integration-testing spock realpath