grails - app real path issue in spock integration test case -
I am working on a code integration test case using the pdf
> Jasper . There is a sub-report
in this jusupur. To get the path of sub-report ( abc.jasper
in web-app / reports /
), first of all I
request. GetSession (). GetServletContext (). GetRealPath ("")
returns scriptwriter / home / mkb / workspace / my-project / web-app
and then the parent in the JSPR report sub- To get the report, insert /reports/abc.jasper
. This is working fine (test-app) while doing test-apo code above code giving / home / mkb / workspace / my-project / target / work / code / code.
and so I am getting it
net.sf.jasperreports.engine.JRException: resource not found: / home / mkb / workspace / my -project / target / work / scriptwriter / report / abzeser
How can I fix or fix this path problem in test cases? Please use the class static method getRealPath () to get the actual path (Grails 2.3.9)
ServletContextHolder.servletContext.getRealPath ('/')
This code is the path to the web-app folder of your application Will give
Comments
Post a Comment