struts2+spring3+junit4的测试问题

我的项目是用struts2.3.1.2、spring3.1.0、hibernate3、junit4.11开发的,现在我要用junit测试我的action,我的struts2的配置文件和spring的配置文件放在resource/struts/struts2.xml和resource/spring/spring.xml下的,我的测试代码如下:

public class AddEquipmentActionTest2 extends StrutsSpringTestCase {
 @Override
 protected String[] getContextLocations() {
  // TODO Auto-generated method stub
  return new String[] {
    "classpath*:resource/spring/spring.xml"
  };
 }
 public void testAction() {

  ActionMapping mapping = getActionMapping("/equipment/addTemplate.do");
  System.out.println(mapping);
  
 }
}

 

但是用这个测试的话mapping为null,现在就测试不下去了,我用tomcat打开以上地址可以访问的。

还有一个问题:struts2.xml如何被junit读取的,我发现用getContextLocations加不加这个struts2.xml都一样,哪位大神可以帮小弟解决一下,谢谢!

 

[url]http://blog.csdn.net/zhuyucheng123/article/details/7839384[/url]

[code="java"]
spring-test你可以用这个测试
[/code]
[url]http://lihao312.iteye.com/admin/blogs/1879534[/url]