Missing configuration resources in StrutsTestCase 2.1.4
I'm trying to use StrutsTestCase 2.1.4 to do unit testing on my Struts application. But when I tried to run the test, a "missing configuration resources for path /WEB-INF/web.xml" error happens.
I looked it up in the FAQ of StrutsTestCase, and followed the instruction to add my application path to the classpath. However, it didn't work.
Then I use the setConfigFile() method to specify the path of web.xml and struts-config.xml.开发者_运维技巧 As you see, it didn't work, either.
Here's the setUp() method override in my test class:
public void setUp() throws Exception {
super.setUp();
File web = new File("E:/JavaPros/stolon/STOLONCAS/web/");
this.setContextDirectory(web);
this.setConfigFile("E:/JavaPros/stolon/STOLONCAS/web/WEB-INF/web.xml");
this.setConfigFile("E:/JavaPros/stolon/STOLONCAS/web/WEB-INF/struts-config.xml");
}
One thing different by using this method is the error msg became "Missing configuration resource for path E:/JavaPros/stolon/STOLONCAS/build/web/WEB-INF/struts-config.xml". This makes me very confused for I'm absolutely sure that there is the struts-config.xml in that path.
精彩评论