1、 单元测试用例设计 项目名称:客户关系管理系统 专业:计算机科学与技术 学号:02171213 03095103 姓名:刘光熠 陈敏珺 指导老师:姚砺 实验日期:2006.6.11 目录 1.序言 3 1.1项目名称 3 1.2测试目的 3 1.3参考文献 3 2.测试计划 4 2.1测试对象 4 2.2 测试人员 5 3.测试方法 5 3.1人工走查 5 3.2白盒测试 5 3.3通过标准 5 1.序言 1.1项目名称
2、 客户关系管理系统单元测试用例设计 1.2测试目的 1、 确保产品完成了它所承诺或公布的功能,并且所有用户可以访问到的功能都有明确的书面说明;一般测试只需要测试出产品的功能,并测试出是否与书面说明一致就可以的了。而汉化测试则必须先测试出原版中承诺的功能是否都具有,还要测试出汉化后的功能与原版是否相同,并找出原因。 2、 确保产品满足性能和效率的要求。软件汉化后往往性能和效率都有一定距离,测试除了测试出原版和汉化版的性能和效率外,还要找出原因。 3、 确保产品是健壮的和适应用户环境的。一般原版都是在非中文的环境下运行,汉化后在中文的环境下运行。汉化测试还需测试出在不同环境下不
3、同版本的健壮性和适应性。 1.3参考文献 《精通软件测试》 《软件测试入门与提高》 《单元测试》 《软件测试实例分析》 2.测试计划 2.1测试对象 修改客户信息模块: String c_name=request.getParameter("c_name"); c_name=new String(c_name.getBytes("ISO8859-1"),"gb2312"); String c_id=request.getParameter("c_id"); c_id=new String(c_id.getBytes("ISO8859-1")
4、"gb2312"); String card_id=request.getParameter("card_id"); if( (card_id != null)&&(card_id.length()!= 0 ) ) { card_id = new String(card_id.getBytes("ISO8859-1"),"gb2312"); } String adress=request.getParameter("adress"); if( (adress != null)&&(adress.length()!=
5、0 ) ) { adress = new String(adress.getBytes("ISO8859-1"),"gb2312"); } String sex=request.getParameter("sex"); if( (sex.equals("male")) ) { sex="男"; } else sex="女"; String birthday=request.getParameter("birthday"); if( (birthday != null)&&(
6、birthday.length()!= 0 ) ) { birthday = new String(birthday.getBytes("ISO8859-1"),"gb2312"); } String phone=request.getParameter("phone"); if( (phone != null)&&(phone.length()!= 0 ) ) { phone = new String(phone.getBytes("ISO8859-1"),"gb2312"); } Strin
7、g mobile_phone=request.getParameter("mobile_phone"); if( (mobile_phone != null)&&(mobile_phone.length()!= 0 ) ) { mobile_phone = new String(mobile_phone.getBytes("ISO8859-1"),"gb2312"); } String fax=request.getParameter("fax"); if( (fax != null)&&(fax.length()!= 0 ) )
8、 { fax= new String(fax.getBytes("ISO8859-1"),"gb2312"); } String email=request.getParameter("email"); if( (email != null)&&(email.length()!= 0 ) ) { email = new String(email.getBytes("ISO8859-1"),"gb2312"); } String remark=request.getParameter("remark")
9、 if( (remark != null)&&(remark.length()!= 0 ) ) { remark = new String(remark.getBytes("ISO8859-1"),"gb2312"); } Class.forName("com.microsoft.jdbc.sqlserver.SQLServerDriver").newInstance(); String url="jdbc:microsoft:sqlserver://localhost:1433;DatabaseName=dengfen"; String
10、user="sa"; String password="123"; Connection conn= DriverManager.getConnection(url,user,password); String sql_modify="update customer set name='"+c_name+"',sex='"+sex+"',card_id='"+card_id+"',adress= '"+adress+"',birthday='"+birthday+"',phone='"+phone+"',mobile_phone='"+mobile_phone+
11、"',fax='"+fax+"',email='"+email+"',remark='"+remark+"' where c_id='"+c_id+"' "; Statement stmt1=conn.createStatement(); stmt1.executeUpdate(sql_modify); stmt1.close(); conn.close(); response.sendRedirect("main.jsp?customer_id="+c_id+""); 2.2 测试人员 刘光熠 陈敏珺
12、3.测试方法 3.1人工走查 本模块的开发者对本模块的代码设计进行讲解、回答问题 检查逻辑错误 代码标准/规范/风格 3.2白盒测试 3.2.1语句覆盖 测试用例:c_name=”sunflower” card_id=”1111” adress=”文汇路300弄” email=”sunflower@” birthday=”1985-9-25” phone= “67794661” mobile_phone =”13003266323” fax= “67709757” sex= “female” remark=” 佘山是个好地方呀!” 3.2.2判定覆盖 c_name
13、sunflower” card_id=”1111” adress=”文汇路300弄” email=”sunflower@” birthday=”1985-9-25” phone= “67794661” mobile_phone =”13003266323” fax= “67709757” sex= “female” remark=” 佘山是个好地方呀!” c_name=null card_id= null adress= null email= null birthday= null phone= null mobile_phone= null fax= null sex
14、 null remark= null 3.2.3分支覆盖 c_name=”sunflower” card_id=”1111” adress=”文汇路300弄” email=”sunflower@” birthday=”1985-9-25” phone= “67794661” mobile_phone =”13003266323” fax= “67709757” sex= “female” remark=” 佘山是个好地方呀!” c_name=null card_id= null adress= null email= null birthday= null phone= null mobile_phone= null fax= null sex= null remark= null 功能测试的通过率是100%。 非功能测试的通过率是90%。






