springmvc 不经过WEB服务器,如何直接给controller层开始测试。springmvc测试
解决方案 »
- 用ftpClient下载FTP上的文件报错问题
- 从后台取出的数据以XML文件显示时为乱码?
- jsp调用FCK出错
- 帮我看看,谢谢!
- 本人能力有限解决不了,希望各位帮帮忙!!!
- 菜鸟问题,在线等
- lookup时遇到一个问题:NoInitialContextException: Need to specify class name in environment or system property怎么办?
- 希望推荐 邮件服务器 在windows下的
- servlet调用Oracle,如何使用jdbc直接进行连接?高分相赠
- 我的程序错在哪里了?
- 我用ajax-pushlet推送紧急求助
- office在线编辑
xxxService service = (xxxService) context.getBean("xxxService");
service.doSomething();
LZ是说这样的东西吗?
还是有必要的,再做持续集成的时候,你需要做单元测试,这个时候通常使用JUNIT来进行测试,在这种情况下,
直接对Controller来进行测试就比较有必要了。建议LZ去参照下面的文章:
http://static.springsource.org/spring/docs/3.2.x/spring-framework-reference/html/testing.htmlUnit testing Spring MVC Controllers
To test your Spring MVC Controllers, use ModelAndViewAssert combined with MockHttpServletRequest, MockHttpSession, and so on from the org.springframework.mock.web package.