Struts2+Spring+Junit单元测试
来源:互联网 发布:淘宝韩版短袖 编辑:程序博客网 时间:2024/05/29 10:10
使用Junit对Struts+spring系统进行单元测试,好处是不用启动tomcat等容器。
简单实例代码如下:
import org.apache.struts2.StrutsSpringTestCase;public class ActionTest extends StrutsSpringTestCase{@Overrideprotected String getContextLocations() {return "classpath*:applicationContext*.xml";}public void testAll() throws Exception{request.addParameter("id", "1");String res=executeAction("/test.action");System.out.println(res);}}
主要是继承StrutsSpringTestCase类。
测试用例中,action返回的数据为json,res即为response的内容。
0 0
- Struts2+Spring+Junit单元测试
- Junit单元测试和spring单元测试
- Junit单元测试和spring单元测试
- Spring Junit单元测试
- Spring + JUnit进行单元测试
- junit spring 注解 单元测试
- spring整合junit单元测试
- SPRING+JUNIT单元测试s
- Spring Junit 单元测试实例
- Spring Boot Junit单元测试
- spring junit 单元测试
- Junit配合Spring单元测试
- Spring Junit单元测试
- Spring Boot Junit单元测试
- spring+junit进行单元测试
- Spring Boot Junit单元测试
- Spring Boot Junit单元测试
- Spring Boot Junit单元测试
- 【转】tableview详解
- 给JavaScript初学者的24条最佳实践
- 关于java的main函数
- 我的java学习笔记
- 七位二进制转换为字母
- Struts2+Spring+Junit单元测试
- txt分割器
- 早期的win32程序
- 最简洁的八皇后
- 88行代码的俄罗斯方块
- 周鸿祎与雷军:从好友到“仇人”
- c语言内存分配问题
- 最长重复子串
- win7远程连接开启方法