The unit tests are located in a different project than the actual application. If I run a method which references a resource, I do not find it from within the test. If I run the same method in the application, everything works fine. So far I tried these two approaches to get an URL to the resource:
new URL("platform:/plugin/application/res/its_name.xml")
and
this.getClass().getResource("/its_name.xml");
Is there any simple way (in eclipse) to make the resource accessible to the test project, or do I need to put the test into the same project as the application?
The folder structure is like this:
application
\src
\packages
\res
tests
\src
在JAR文件中构建您的项目并将其添加到测试项目中...但是我真的不建议您将项目与junit测试分开,因为这只会使您的工作变得更困难。
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.