SSH框架搭建的网站怎么进行单元测试,用什么工具?
新手求助,如题。。。很急。。。[ 本帖最后由 dongxl123 于 2010-1-19 16:04 编辑 ] 现在还是SSH框架,有点过时了吧!
如果你的开发平台是MyEclipse,可以装一个Junit插件,运用插件进行单元测试。
步骤:
1、通过源代码整理代码逻辑,画出流程图;
2、设计单元测试用例;
3、依据用例编写单元测试代码;
4、执行单元测试代码;
5、分析结果。
回复 2# 的帖子
高手!1.现在流行什么?
2.public ActionForward execute(ActionMapping mapping, ActionForm form,HttpServletRequest request, HttpServletResponse response)throws Exception {}
像这个方法该怎么测?
应该是SSI框架搭建的网站怎么单元测试,比如这个类?
package com.zju.cdpf.web.struts.action;import java.io.PrintWriter;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
import org.apache.struts.action.Action;
import org.apache.struts.action.ActionForm;
import org.apache.struts.action.ActionForward;
import org.apache.struts.action.ActionMapping;
import com.zju.cdpf.biz.dao.ibatis.dataobject.Member;
import com.zju.cdpf.biz.dao.ibatis.dataobject.MemberTemp;
import com.zju.cdpf.biz.service.RegisterService;
public class CheckLoginIdAction extends Action {
private RegisterService registerService;
public RegisterService getRegisterService() {
return registerService;
}
public void setRegisterService(RegisterService registerService) {
this.registerService = registerService;
}
@Override
public ActionForward execute(ActionMapping mapping, ActionForm form,
HttpServletRequest request, HttpServletResponse response)
throws Exception {
response.setContentType("text/plain;charset=utf-8");
String loginId=request.getParameter("loginId");
PrintWriter out = response.getWriter();
Member member=new Member();
member.setLoginId(loginId);
MemberTemp mTemp=new MemberTemp();
mTemp.setLoginId(loginId);
boolean b=registerService.getMember(member);
boolean bb=registerService.getMemberTemp(mTemp);
if(b||bb){
out.write("该ID已注册");
}else {
out.write("可以注册");
}
return null;
}
}
[ 本帖最后由 dongxl123 于 2010-1-19 16:49 编辑 ] up
回复 2# 的帖子
刘妹子,强人喽,呵!同问!!!!!!!!
有哪位高手能给出J2EE web系统单元测试的详细方法啊 同求实例,尤其是如何初始化http request相关的信息
页:
[1]