《J2EE系统架构和程序设计》课程设计实训项目——带有即时通讯功能的BBS系统的测试计划说明书
- 格式:pdf
- 大小:306.42 KB
- 文档页数:15
目录1.1《J2EE系统架构和程序设计》课程设计项目实训项目——某软件学院学生选课管理系统 (2)1.1.1项目的系统需求及约束描述 (2)1.1.2项目的系统分析 (3)1.1.3项目的系统设计——系统的概要设计 (3)1.1.4项目的系统设计——系统的详细设计 (10)1.1.5项目的系统实现——学生功能模块 (22)1.1.6项目的系统实现——系统管理员功能模块 (35)1.1.7应用JUnit框架对项目中的核心功能类进行单元测试 (55)1.1《J2EE系统架构和程序设计》课程设计项目实训项目——某软件学院学生选课管理系统1.1.1项目的系统需求及约束描述1、功能性的需求利用Struts框架技术设计和实现一个软件学院学生课程选课的Web应用系统,具体的应用功能要求如下:1)应该提供对选课的学生进行基本的管理功能:包括注册、登陆、修改和在线注销等方面的功能2)应该提供对课程进行选课、查询课程信息、统计所选择的课程的总学分等基本功能3)对部分的功能模块中的数据应该采用XML文件的形式作为持久化的载体,并利用Java中的XML解析技术进行读/写该XML文件中的数据4)对部分的功能模块中的页面采用XML+XSLT的方式代替JSP页面进行显示5)利用过滤器组件技术实现系统的安全身份验证2、系统中的非功能性需求(1)允许大量用户同时访问及进行页面交互;(2)选课期间,系统应该能够在7*24小时环境下运行。
(3)数据不能丢失。
3、系统的环境和设计约束(1)环境约束:LAN,WAN环境都行(2)设计约束:采用Java平台实现(3)项目中所应用的数据库系统1)选择每个学员自己所熟悉的某种数据库系统,可以为Access、SQLServer、Oracl、MySQL或者其它。
并且各自在该数据库中创建出项目中的各个数据库表和表结构。
2)必须使用数据库连接池和数据源来连接数据库(可以为应用服务器系统中所提供的或者是第三方如Apache DBCP等)。
基于J2EE Struts框架的课程设计实训项目——《BBS论坛系统》——在BBS论坛系统项目的表示层中应用EL和JSTL等技术的应用示例1.1.1在BBS论坛系统项目的表示层中应用EL技术1、EL表达式语言(1)主要的优点使用标签(Tag)和EL表达式语言的主要目的就是为了能够避免在JSP页面中出现过多的<% %>的语句,使页面与后台的Java代码相互分离。
应用表达式语言主要有以下几大好处:1)避免直接在页面中应用(MyClassType) request.getAttribute()和myEntityBean.getMyProperty()之类的脚本语句,从而能够使页面更加简洁;2)支持运算符(如+-*/),比普通的标签具有更高的应用自由度和更强的功能;3)简单明了地表达程序代码的逻辑,比直接使用脚本代码更可读与更便于维护。
(2)JSP2.0的一个主要的组件为支持EL的表达式语言因此,EL表达式语言可以直接在JSP页面中应用,而不需要引入任何其它的系统库包文件。
2、EL语言是JSTL输出(输入)一个JA V A表达式的表示形式。
在JSTL中,EL语言只能在属性值中使用;EL语言只能通过建立表达式${exp1}来进行调用。
在属性值中使用表达式有三种方式。
(1)value属性包含一个表达式<c:out value="${requestScope.errorText}" />在这种情况下,表达式值被计算出来并根据类型转换规则赋值给value属性。
上面的${requestScope.errorText}就是一个EL,它相当于JSP语句<%=request.getAttribute("errorText")%>。
(2)value属性包含一个或多个属性,这些属性被文本分割或围绕< c:out value="some${expr}${expr}text${expr}"/>在这种情况下,表达式从左到右进行计算,并将结果转换为字符串型(根据类型转换规则),并将结果赋值给value属性(3)value属性仅仅包含文本< c:out value="sometext"/>在这种情况下,字符串型属性value将根据类型转换规则转换为标签所希望的类型。
J2EE课程设计及项目实训教学中的项目需求分析——《BBS论坛系统》的需求说明1.1.1BBS论坛需求说明1、该网站建设包含以下子系统2、用户脚色划分(1)普通用户普通用户以游客身份登录,只具有察看帖子的功能,不能留言。
(2)注册用户具备普通用户所有的能力。
并且是已经注册了的用户,可以登录、修改个人信息,并且可以发表留言。
(3)管理员管理员登录以后可以对论坛系统进行管理,包括论坛的基本信息、用户设置,还可以修改管理员密码。
3、前台服务系统修改帖子(from Use Case View)3.1、注册主要是指除管理员以外的用户角色,在网上在线填写一些会员的注册信息。
注册后即可成为BBS论坛会员。
会员注册信息如下:注册确认用户通过网上在线注册后,由系统管理员收集相应的资料,核实后,进行用户注册确认,确认后用户成为会员正式生效,可以享受网站提供的各种服务。
3.2、登录用户输入登录信息,如用户名、密码、验证码,以会员的身份进入本论坛。
或者以游客身份登录,不需要输入任何信息即可。
3.3、修改信息会员登录成功后,可以修改自己的信息,如密码等。
3.4、留言管理会员有发布,回复帖子的功能。
但只有注册并且登录成功的会员才具有这一功能。
会员可以修改自己的留言和查看、删除、自己的帖子。
4、后台管理系统(1)各个子模块(2)系统管理员及其职责5、后台管理系统系统管理员登陆: 系统管理员提交用户名和密码,系统验证用户名和密码的合法性,系统显示系统管理员管理页面(包含管理员的信息)6、论坛基本信息管理:对网站参数、通行证设置、COOKIE设置、公告设置进行管理。
7、管理用户:管理员设置一些用户的信息,如:用户权限、封锁用户、用户级别设置等等。
8、发帖设置:对用户的帖子设置、上传文件设置、全文检索设置、缓存设置进行管理。
《J2EE系统架构和程序设计》课程上机实践教学大纲1.1.19月11日上机实践教学(2学时)的主要内容1、【实验目的】(1)熟练地应用MyEclipse工具(2)掌握J2EE Web表示层JSP有关的开发技术及应用(3)掌握J2EE Web控制层Servlet有关的开发技术及应用2、【实验性质】综合应用型实验,辅助对课堂学习的有关知识的理解。
3、【实验环境】(1)硬件普通的计算机,并且提供局域网络环境(2)软件前台Web页面开发工具Macromedia Dreamweaver MX 2004,后台Java程序开发工具MyEclipse6.5,应用服务器采用Tomcat服务器。
4、【实验内容】——实现系统中的用户信息管理功能模块的表示层页面及进行简单的响应(1)JSP有关的主要的内容——参考“JSP教学示例及课后练习参考资料”1)MyEclipse开发工具的正确地应用2)Tomcat服务器的正确配置和应用、并注意其中的几个特殊的文件夹——bin、webapps和work等3)重点掌握JSP中的几个主要的内置对象的应用,特别是request、response、session和application等4)体验Session的会话跟踪——安全控制和保护、体验Session的会话生命期5)以配置方式进行Web开发中的异常捕获(2)“项目需求说明书”的格式及范例文档1.1.29月18日上机实践教学(2学时)的主要内容1、【实验目的】(1)进一步熟练地应用MyEclipse工具(2)深入掌握J2EE Web控制层Servlet有关的开发技术及应用2、【实验性质】综合应用型实验,辅助对课堂学习的有关知识的理解。
3、【实验环境】(1)硬件普通的计算机,并且提供局域网络环境(2)软件前台Web页面开发工具Macromedia Dreamweaver MX 2004,后台Java程序开发工具MyEclipse6.5,应用服务器采用Tomcat服务器。
《J2EE系统架构和程序设计》课程设计实训项目——基于Struts +Spring +Hibernate架构的BBS网上论坛系统需求规格说明书1.1.1引言1、目的本文档作为BBS的需求说明文档,用于与用户确定最终的目标,并成为协议文本的一部分,同时也是本系统设计人员的基础文档。
2、背景BBS论坛,或者称为社区,是电子商务网站中一种常见功能,也是互联网上一种极为常见的互动交流服务。
它为上网用户提供了也各自由的讨论区。
通过论坛可以向用户提供开放性的分类专题讨论区服务,同时注册的用户可以根据需要在论坛上发表文章,交流技术经验,或者提出问题并表达自己的观点。
不仅如此,上网的用户还可以在论坛中看到他人发表的文章,并且能够对该文章进行评论。
一般情况下,BBS按不同主题分为多个布告栏,其设立多是依据使用者的要求和喜好,但多具有信件交流、软件交流、信息发布等功能。
目前,大部分BBS由教育机构、研究机构或商业机构管理,大多有自己的拨入电话号码,用户只需电脑、调制解调器和电话线就可通过电话拨号登录BBS站点。
3、定义(1)GB:中华人民共和国国家标准的英文缩写字母(2)构件:具有某种功能的可重用的软件模版单元,表示了系统中主要的计算元素和数据存储。
(3)逻辑视图:描述支持系统的功能需求的视图。
(4)开发视图:也称模块视图,主要侧重于软件模块的组织和管理描述。
(5)BBS:Bulletin Board Service4、参考资料(1)J2EE项目实训Hibernate框架技术(21世纪高等学校实用软件工程教育规划教材)杨少波编著清华大学出版社 2008 年5月(2)J2EE项目实训Spring框架技术(21世纪高等学校实用软件工程教育规划教材)杨少波编著清华大学出版社 2008 年5月(3)J2EE项目实训UML及设计模式(21世纪高等学校实用软件工程教育规划教材)杨少波编著清华大学出版社 2008 年5月(4)J2EE项目实训Struts框架技术(21世纪高等学校实用软件工程教育规划教材)杨少波编著清华大学出版社2008 年10月(5)《精通Struts设计与开发》作者:孙卫琴电子工业出版社(6)《Spring从入门到精通》作者:郭锋清华大学出版社(7)《Hibernate开发技术祥解》作者:孙卫琴电子工业出版社(8)《J2EE应用开发技术祥解》作者:刘晓华电子工业出版社(9)《设计模式》作者:Erich Gamma等机械工业出版社1.1.2任务概述1、目标一个典型的网上论坛BBS系统一般都应该提供诸如:会员管理、论坛分类主题管理、论坛文章管理、论坛公告管理等功能,同时也因该为论坛的管理人员,例如:版主、网页维护人员提供后台管理功能,包括删除一些文章、发布论坛公告等。
《J2EE系统架构和程序设计》课程设计实训项目——基于Struts 框架的公安培训系统概要设计说明书1.1.1引言1、背景互联网以前所未有的速度发展,成为与报纸、广播、电视相比肩的第四媒体,同时正以其便捷的信息传输形式改变着人们的消费模式,利用简单、快捷、低成本的电子通信方式,买卖双方不谋面就可以进行各种商贸活动,走向商业的互联网已经成为网络经济的大势所趋。
1996年前后,在美国学术界提出“电子商务”(E-Business或E-Commerce)的概念短短几年的时间里,这一概念已在全球各地被广泛接受。
根据买方和买方的不同,电子商务市场可以划分为4种类型:B2B、B2C、C2B和C2C。
就规模而言,B2B和B2C居于主导地位。
B2C是商家与顾客之间的商务活动,它将成为电子商务的一种主要的商务形式,“B2B 网上购物网站”是实现这种商务活动的电子平台。
B2B是商家与商家之间的商务活动,它也将成为电子商务的一种主要的商务形式,“B2B商务网站”是实现这种商务活动的电子平台。
眼下电子商务网站正如雨后春笋般地大量涌现,企业网络化已经成为一种时尚。
本次作业我们将实践如何实现企业网络化,搭建公安培训系统平台。
2、编写目的说明编写这份概要设计说明书的目的,指出预期的读者。
3、概要设计说明书目的本概要设计说明书说明了公安培训系统设计的整体结构。
4、预期读者本系统开发人员及维护人员。
5、定义(1)GB:中华人民共和国国家标准的英文缩写字母(2)构件:具有某种功能的可重用的软件模版单元,表示了系统中主要的计算元素和数据存储。
(3)逻辑视图:描述支持系统的功能需求的视图。
(4)开发视图:也称模块视图,主要侧重于软件模块的组织和管理描述。
6、参考资料(1)J2EE项目实训Hibernate框架技术(21世纪高等学校实用软件工程教育规划教材)杨少波编著清华大学出版社 2008 年5月(2)J2EE项目实训Spring框架技术(21世纪高等学校实用软件工程教育规划教材)杨少波编著清华大学出版社 2008 年5月(3)J2EE项目实训UML及设计模式(21世纪高等学校实用软件工程教育规划教材)杨少波编著清华大学出版社 2008 年5月(4)J2EE项目实训Struts框架技术(21世纪高等学校实用软件工程教育规划教材)杨少波编著清华大学出版社2008 年10月(5)《JSP与数据库连接》刘瑞挺,高等教育出版社(6)《数据库原理与方法》郑若忠王鸿武,湖南科学技术出版社(7)《软件需求》(美)Karl E.Wiegers 著,刘伟琴刘洪涛译1.1.2需求规定1、输入输出要求(1)界面风格要求整体界面美观,有清晰的层次感,布局简洁、合理。
目录1.1BBS论坛系统项目完整实现实例(业务层UserInfo相关的功能类) (2)1.1.1实现系统的业务层中的各个业务实体组件类 (2)1.1.2实现系统的业务层中的各个业务功能处理的接口 (15)1.1.3实现系统的业务层中的各个业务功能处理接口的实现类 (17)1.1BBS论坛系统项目完整实现实例(业务层UserInfo相关的功能类)1.1.1实现系统的业务层中的各个业务实体组件类1、业务实体UserInfoBaseVO(1)业务实体UserInfoBaseVO,包名称为com.px1987.webbbs.model,并且实现java.io.Serializable接口(2)添加下面的属性private String userName;private String userPassWord;private Integer userType;private String aliaoName;private String passWordAsk;private String userImage;private String userMail;private String registerTime;private int userID;private String userResume;private Integer type_User_Admin; //该成员主要是区分用户的类型-----注册用户(=1)还是管理员(=2)(3)并为它们提供get/set方法(4)最后为下面的内容package com.px1987.webbbs.model;import java.io.Serializable;public class UserInfoBaseVO implements Serializable{private String userName;private Integer userType;private String aliaoName;private String passWordAsk;private String userImage;private String passWordAnswer;private String userMail;private String registerTime;private int userID;private String userResume;private Integer type_User_Admin; //该成员主要是区分用户的类型-----注册用户(=1)还是管理员(=2)public UserInfoBaseVO() {// TODO 自动生成构造函数存根}public String getAliaoName() {return aliaoName;}public void setAliaoName(String aliaoName) {this.aliaoName = aliaoName;}public String getPassWordAnswer() {return passWordAnswer;}public void setPassWordAnswer(String passWordAnswer) {this.passWordAnswer = passWordAnswer;}public String getPassWordAsk() {return passWordAsk;}public void setPassWordAsk(String passWordAsk) { this.passWordAsk = passWordAsk;}public String getRegisterTime() {return registerTime;}public void setRegisterTime(String registerTime) { this.registerTime = registerTime;}public Integer getType_User_Admin() {return type_User_Admin;}public void setType_User_Admin(Integer type_User_Admin) { this.type_User_Admin = type_User_Admin;}public int getUserID() {return userID;}public void setUserID(int userID) {erID = userID;}public String getUserImage() {return userImage;}public void setUserImage(String userImage) {erImage = userImage;}public String getUserMail() {return userMail;}public void setUserMail(String userMail) { erMail = userMail;}public String getUserName() {return userName;}public void setUserName(String userName) { erName = userName;}public String getUserPassWord() {return userPassWord;}public void setUserPassWord(String userPassWord) { erPassWord = userPassWord;}public String getUserResume() {return userResume;}public void setUserResume(String userResume) { erResume = userResume;}public Integer getUserType() {return userType;}public void setUserType(Integer userType) {erType = userType;}}2、业务实体UserInfoBaseVO 的子类UserInfoVO(1)业务实体UserInfoVO,包名称为com.px1987.webbbs.model,并且继承UserInfoBaseVO 类,同时也实现java.io.Serializable接口(2)添加下面的属性//下面的属性来自于UserInfoBasePO类private int userSex;private String userBirthDay;private String userComeFrom;// 下面的属性来自于UserInfoPO类private Map contactMethod = new HashMap();// 下面的属性主要是对注册用户的联系方式进行分离private String userICQCode;private String userMSNCode;private String userQQCode;private String userSign;private int emailVisible;private int acceptAdvise;// 下面的属性来自于AdminUserInfoPO类private String workUnit;private String studyHistory;private String studySchool;private String idCardNo;private int type_User_Admin; //该成员主要是区分用户的类型-----注册用户(=1)还是管理员(=2)// 下面的属性来自于AdminUserInfoPO类private String workUnit;private String studyHistory;private String studySchool;private String idCardNo;(3)并为它们提供get/set方法(4)最后为下面的状态内容package com.px1987.webbbs.model;import java.io.Serializable;import java.util.*;public class UserInfoVO extends UserInfoBaseVO implements Serializable {//下面的属性来自于UserInfoBasePO类private int userSex;private String userBirthDay;private String userComeFrom;// 下面的属性来自于UserInfoPO类private Map contactMethod = new HashMap();// 下面的属性主要是对注册用户的联系方式进行分离private String userICQCode;private String userMSNCode;private String userQQCode;private String userSign;private int emailVisible;private int acceptAdvise;// 下面的属性来自于AdminUserInfoPO类private String workUnit;private String studyHistory;private String studySchool;private String idCardNo;public UserInfoVO(){super();userSex=1;userBirthDay="";userComeFrom="";userSign="";emailVisible=1;acceptAdvise=1;userICQCode="";userMSNCode="";userQQCode="";workUnit="";studyHistory="";studySchool="";idCardNo="";}public int getAcceptAdvise() {return acceptAdvise;}public void setAcceptAdvise(int acceptAdvise) { this.acceptAdvise = acceptAdvise;}public Map getContactMethod() {return contactMethod;}public void setContactMethod(Map contactMethod) { this.contactMethod = contactMethod;}public int getEmailVisible() {return emailVisible;}public void setEmailVisible(int emailVisible) { this.emailVisible = emailVisible;}public String getIdCardNo() {return idCardNo;}public void setIdCardNo(String idCardNo) { this.idCardNo = idCardNo;}public String getStudyHistory() {return studyHistory;}public void setStudyHistory(String studyHistory) { this.studyHistory = studyHistory;}public String getStudySchool() {return studySchool;}public void setStudySchool(String studySchool) { this.studySchool = studySchool;}public String getUserBirthDay() {return userBirthDay;}public void setUserBirthDay(String userBirthDay) { erBirthDay = userBirthDay;}public String getUserComeFrom() {return userComeFrom;}public void setUserComeFrom(String userComeFrom) { erComeFrom = userComeFrom;}public String getUserICQCode() {return (String)contactMethod.get("userICQCode");}/** 下面的各个方法为“帮助方法”*/public void setUserICQCode(String userICQCode) {contactMethod.put("userICQCode", userICQCode);}public String getUserMSNCode() {return (String)contactMethod.get("userMSNCode");}public void setUserMSNCode(String userMSNCode) {contactMethod.put("userMSNCode", userMSNCode);}public String getUserQQCode() {return (String)contactMethod.get("userQQCode");}public void setUserQQCode(String userQQCode) {contactMethod.put("userQQCode", userQQCode);}public void addOneContactMethod(String oneContactMethodKey,String oneContactMethodValue) //该方法为“帮助方法”{contactMethod.put(oneContactMethodKey,oneContactMethodValue);}public String getOneContactMethod(String oneContactMethodKey) {return (String)contactMethod.get(oneContactMethodKey);}public int getUserSex() {return userSex;}public void setUserSex(int userSex) {erSex = userSex;}public String getUserSign() {return userSign;}public void setUserSign(String userSign) {erSign = userSign;}public String getWorkUnit() {return workUnit;}public void setWorkUnit(String workUnit) {this.workUnit = workUnit;}}1.1.2实现系统的业务层中的各个业务功能处理的接口1、接口UserInfoManageInterface,包名称为com.px1987.webbbs.model2、设计该接口中的相关功能方法package com.px1987.webbbs.model;import com.px1987.webbbs.exception.*;import java.util.*;public interface UserInfoManageInterface{public boolean doUserLogin(UserInfoVO oneUserInfoVO) throws WebBBSException;public boolean doUserRegister(UserInfoVO oneUserInfoVO) throws WebBBSException;public boolean doUpdateOneUserInfo(UserInfoVO oneUserInfoVO) throws WebBBSException;public boolean doUpdateOneRegisterUserPassWord(UserInfoVO oneUserInfoVO,String newPassWord) throws WebBBSException;public boolean doUpdateOneAdminUserPassWord(UserInfoVO oneUserInfoVO,StringnewPassWord) throws WebBBSException;public boolean doCheckUserNameExist(String userName,Integer type_User_Admin) throws WebBBSException;public String doGetOneRegisterUserPassWord(UserInfoVO oneRegisterUserInfoVO) throws WebBBSException;public String doGetOneAdminUserPassWord(UserInfoVO oneAdminUserInfoVO) throws WebBBSException;public UserInfoVO doGetOneRegisterUserInfo(String registerUserID) throws WebBBSException;public UserInfoVO doGetOneRegisterUserInfo(UserInfoVO oneRegisterUserInfoVO) throws WebBBSException;public UserInfoVO doGetOneAdminUserInfo(String adminUserID) throws WebBBSException;public UserInfoVO doGetOneAdminUserInfo(UserInfoVO oneAdminUserInfoVO) throws WebBBSException;public UserInfoBaseVO doGetOneUserInfo(String userName,String userPassWord, Integer type_User_Admin) throws WebBBSException;public ArrayList doGetAllUserNameInfo(String userName) throws WebBBSException;public boolean doDeleteOneRegisterUserInfo(String registerUserID) throws WebBBSException;public boolean doDeleteOneRegisterUserInfo(UserInfoVO oneRegisterUserInfoVO) throws WebBBSException;public boolean doDeleteOneAdminUserInfo(String adminUserID) throws WebBBSException;public boolean doDeleteOneAdminUserInfo(UserInfoVO oneAdminUserInfoVO) throws WebBBSException;public ArrayList doGetAllRegisterUserInfo() throws WebBBSException;public ArrayList doGetSomeRegisterUserInfo(Map registerUserInfos) throws WebBBSException;public ArrayList doGetAllAdminUserInfo() throws WebBBSException;public ArrayList doGetSomeAdminUserInfo(Map adminUserInfos) throws WebBBSException;}1.1.3实现系统的业务层中的各个业务功能处理接口的实现类1、接口UserInfoManageInterface的实现类UserInfoManageImple,包名称为com.px1987.webbbs.model2、编程该业务组件类package com.px1987.webbbs.model;import erInfoPO;import erManageDAOInterface;import erManageDAOJDBCImple;import com.px1987.webbbs.exception.WebBBSException;public class UserInfoManageImple implements UserInfoManageInterface { public UserInfoManageImple(){}public UserInfoVO doGetMaxIDUserInfo() throws WebBBSException { return null;}public int doGetTotalUserCounter() throws WebBBSException {return 0;}public String doGetUserPassWord(String userName, String passWordAnswer, String passWordAsk) throws WebBBSException {return null;}public UserInfoVO doShowOneUserInfo(int userID) throws WebBBSException { return null;}public boolean doTestUserNameValid(String userName) throws WebBBSException { return false;}public boolean doUpdateUserInfo(UserInfoVO oneUserInfo)throws WebBBSException {return false;}public boolean doUserLogin(UserInfoVO oneUserInfo) throws WebBBSException {String userName=oneUserInfo.getUserName();String userPassWord=oneUserInfo.getUserPassWord();boolean okOrNot=false;UserManageDAOInterface oneUserManageDAOJDBCImple=new UserManageDAOJDBCImple();UserInfoPO oneUserInfoPO=oneUserManageDAOJDBCImple.SelectOneUserInfoData(userName, userPassWord);if(oneUserInfoPO==null){okOrNot=false;}else{okOrNot=true;}return okOrNot;}public boolean doUserRegister(UserInfoVO oneUserInfo)throws WebBBSException{return false;}。
基于J2EE Struts框架的课程设计实训项目——《BBS论坛系统》——实现项目中的数据库连接组件及对应的单元测试用例(第1/4部分)1.1.1构造基于JDBC技术实现的数据访问层中的数据库连接组件1、添加一个属性配置文件 classNameConfig.properties(1)为什么要采用配置文件?作用是什么?----灵活地满足变化!如何对配置文件中的项目进行读写?(2)在项目中添加属性配置文件 classNameConfig.properties目前的内容如下JDBC_DBDriver= com.mysql.jdbc.DriverJDBC_URL = jdbc:mysql://localhost:3306/bbsdatabasedbUserName=rootdbUserPassWord=rootdbcp_maxActive=10dbcp_maxActive=10connectDBBean.className=com.px1987.webbbs.dao.ConnectDBBean注意:也可以采用XML形式的配置文件。
3、添加一个获得配置属性的类ClassNameConfig(1)类名称为ClassNameConfig,包名称为com.px1987.webbbs.config(2)代码如下package com.px1987.webbbs.config;import java.util.Properties;import java.io.*;public class ClassNameConfig {public ClassNameConfig() {}private static Properties props=null;static {props= new Properties();try{InputStream input =Thread.currentThread().getContextClassLoader().getResource("classNameConfig.properties").openStream();props.load(input);}catch(Exception e){e.printStackTrace();}}public static String getProperty(String propName){return props.getProperty(propName);}public static void setProperty(String propName,String propValue){ props.setProperty(propName, propValue);}}其中的getResourceAsStream方法是查找具有给定名称的资源,返回 InputStream对象;而getResource方法是查找带有给定名称的资源路径。
基于J2EE Struts框架的课程设计实训项目——《BBS论坛系统》——BBS信息管理的DAO组件的功能实现及单元测试(第1/2部分)1.1.1BBS信息管理的DAO组件的实现1、在项目中添加一个针对BBSInfoManageDAOInterface的DAO接口提供一个实现类(1)类名称为BBSInfoManageDAOSpringHibernateImple,包名称为com.px1987.webbbs.springhibernatedao、并且继承于HibernateDaoSupport类注意:此时的DAO组件不再继承于Observable类,对产生异常时的日志记录可以改用Spring 的异常通知来实现。
(2)编程该实现类package com.px1987.webbbs.springhibernatedao;import java.util.ArrayList;import java.util.Date;import java.util.Iterator;import java.util.List;import java.util.Observable;import org.hibernate.HibernateException;import org.hibernate.Query;import org.hibernate.Session;import org.hibernate.SessionFactory;import org.hibernate.Transaction;import org.springframework.orm.hibernate3.HibernateTemplate;import com.px1987.webbbs.config.ClassNameConfig;import com.px1987.webbbs.dao.BBSInfoManageDAOInterface;import com.px1987.webbbs.dao.BBSInfoPO;import com.px1987.webbbs.dao.RoleInfoPO;import com.px1987.webbbs.exception.WebBBSException;import com.px1987.webbbs.hibernatedao.HibernateUtil;import com.px1987.webbbs.util.LogInfoFactory;/*public class BBSInfoManageDAOSpringHibernateImple extends HibernateDaoSupport implements BBSInfoManageDAOInterface*/public class BBSInfoManageDAOSpringHibernateImple extends Observable implements BBSInfoManageDAOInterface{private SessionFactory sessionFactory;public void setSessionFactory(SessionFactory sessionFactory) {this.sessionFactory = sessionFactory;}public BBSInfoManageDAOSpringHibernateImple() {}public boolean deleteOneBBSInfo(int bbsID) throws WebBBSException {boolean OKOrNot=false;Session session=null;Transaction tx=null;try{session = sessionFactory.openSession();/* 注意:不是session = sessionFactory.getCurrentSession();否则会出现下面的错误* No Hibernate Session bound to thread, and configuration does not allow creation of non-transactional one here*/tx = session.beginTransaction();BBSInfoPO oneBBSPOTODeleted=(BBSInfoPO)session.get(BBSInfoPO.class,new Integer(bbsID));if(oneBBSPOTODeleted==null){WebBBSException oneWebBBSException=new WebBBSException("在数据库表中不存在指定bbsID="+bbsID+"的数据顶目!");int logImpleKind=Integer.parseInt(ClassNameConfig.getProperty("logImpleKind"));this.addObserver(LogInfoFactory.newLogInstance(logImpleKind));this.setChanged(); //注意要设置变化点notifyObservers(oneWebBBSException); //当出现异常时将通知各个观察者throw oneWebBBSException;}session.delete(oneBBSPOTODeleted);mit();OKOrNot=true;}catch (HibernateException e){int logImpleKind=Integer.parseInt(ClassNameConfig.getProperty("logImpleKind"));this.addObserver(LogInfoFactory.newLogInstance(logImpleKind));this.setChanged(); //注意要设置变化点notifyObservers(e); //当出现异常时将通知各个观察者throw new WebBBSException("在BBSInfoManageDAOHibernateImple类中的DeleteOneBBSInfo方法出现了HibernateException异常");}finally{session.close();}return OKOrNot;}public boolean deleteOneRoleInfo(int roleID) throws WebBBSException {boolean OKOrNot=false;Session session=null;Transaction tx=null;try{session = sessionFactory.openSession();tx = session.beginTransaction();RoleInfoPO oneRoleInfoPOTODeleted=(RoleInfoPO)session.get(RoleInfoPO.class,new Integer(roleID));if(oneRoleInfoPOTODeleted==null){throw new WebBBSException("在数据库表中不存在指定bbsID="+roleID+"的数据顶目!");}session.delete(oneRoleInfoPOTODeleted);mit();OKOrNot=true;}catch (HibernateException e){int logImpleKind=Integer.parseInt(ClassNameConfig.getProperty("logImpleKind"));this.addObserver(LogInfoFactory.newLogInstance(logImpleKind));this.setChanged(); //注意要设置变化点notifyObservers(e); //当出现异常时将通知各个观察者throw new WebBBSException("在BBSInfoManageDAOHibernateImple类中的DeleteOneRoleInfo方法出现了HibernateException异常");}finally{session.close();}return OKOrNot;}public boolean insertBBSInfo(BBSInfoPO oneBBSInfoPO) throws WebBBSException { boolean OKOrNot=false;Session session=null;Transaction tx=null;try {session = sessionFactory.openSession();tx = session.beginTransaction();session.save(oneBBSInfoPO);mit();OKOrNot=true;}catch (HibernateException e){int logImpleKind=Integer.parseInt(ClassNameConfig.getProperty("logImpleKind"));this.addObserver(LogInfoFactory.newLogInstance(logImpleKind));this.setChanged(); //注意要设置变化点notifyObservers(e); //当出现异常时将通知各个观察者throw new WebBBSException("在BBSInfoManageDAOHibernateImple类中的insertOneUserInfo方法出现了HibernateException异常");}finally {session.close();}return OKOrNot;}public boolean insertRoleInfo(RoleInfoPO oneRoleInfoPO) throws WebBBSException { boolean OKOrNot=false;Session session=null;Transaction tx=null;try{session = sessionFactory.openSession();tx = session.beginTransaction();session.save(oneRoleInfoPO);mit();OKOrNot=true;}catch (HibernateException e){int logImpleKind=Integer.parseInt(ClassNameConfig.getProperty("logImpleKind"));this.addObserver(LogInfoFactory.newLogInstance(logImpleKind));this.setChanged(); //注意要设置变化点notifyObservers(e); //当出现异常时将通知各个观察者throw new WebBBSException("在BBSInfoManageDAOHibernateImple类中的insertRoleInfoInfo方法出现了HibernateException异常");}finally{session.close();}return OKOrNot;}public ArrayList<BBSInfoPO> pageSelectDBData(String hqlSelect, int firstResult,int maxResults) throws WebBBSException{List selectResult = null;ArrayList allBBSInfoPO = new ArrayList();Session session = null;Transaction tx = null;Query query =null;try{session = sessionFactory.openSession();tx = session.beginTransaction();query = session.createQuery(hqlSelect);query.setCacheable(true); //激活查询缓存query.setFirstResult(firstResult); //设置希望开始的行数---开始的行号从0 计数query.setMaxResults(maxResults); //设置希望返回的最大行数selectResult=query.list();Iterator allBBSInfoPOItem=selectResult.iterator();while(allBBSInfoPOItem.hasNext()){BBSInfoPO oneBBSInfoPO=(BBSInfoPO)allBBSInfoPOItem.next();allBBSInfoPO.add(oneBBSInfoPO);}mit();}catch (HibernateException e){int logImpleKind=Integer.parseInt(ClassNameConfig.getProperty("logImpleKind"));this.addObserver(LogInfoFactory.newLogInstance(logImpleKind));this.setChanged(); //注意要设置变化点notifyObservers(e); //当出现异常时将通知各个观察者throw new WebBBSException("在BBSInfoManageDAOHibernateImple类中的pageSelectDBData方法出现了HibernateException异常");}finally{/**由于在Service层中需要应用Lazy加载技术,因此不能关闭SessionHibernateUtil.closeSession();*/}return allBBSInfoPO;}public ArrayList<BBSInfoPO> selectSomeBBSInfo(String HQLSelect) throws WebBBSException{List selectResult = null;ArrayList allBBSInfoPO = new ArrayList();Session session = null;Transaction tx = null;Query query =null;try{session = sessionFactory.openSession();tx = session.beginTransaction();query = session.createQuery(HQLSelect);query.setCacheable(true); //激活查询缓存selectResult=query.list();Iterator allBBSInfoPOItem=selectResult.iterator();while(allBBSInfoPOItem.hasNext()){BBSInfoPO oneBBSInfoPO=(BBSInfoPO)allBBSInfoPOItem.next();allBBSInfoPO.add(oneBBSInfoPO);}mit();}catch (HibernateException e){int logImpleKind=Integer.parseInt(ClassNameConfig.getProperty("logImpleKind"));this.addObserver(LogInfoFactory.newLogInstance(logImpleKind));this.setChanged(); //注意要设置变化点notifyObservers(e); //当出现异常时将通知各个观察者throw new WebBBSException("在BBSInfoManageDAOHibernateImple类中的selectBBSInfoByBBSAuthor方法出现了HibernateException异常");}finally{// HibernateUtil.closeSession(); //由于在Service层中需要应用Lazy加载技术,因此不能关闭Session}return allBBSInfoPO;}public ArrayList<BBSInfoPO> selectBBSInfoByBBSAuthor(String authorName) throws WebBBSException {String HQLQuery="from com.px1987.webbbs.dao.BBSInfoPO as oneBBSInfoPO order by oneBBSInfoPO.hits desc where oneBBSInfoPO.author='"+authorName+"'";return selectSomeBBSInfo(HQLQuery);}public ArrayList<BBSInfoPO> selectBBSInfoByBBSHits(int bbsHitsCounte) throws WebBBSException {String HQLQuery="from com.px1987.webbbs.dao.BBSInfoPO as oneBBSInfoPO where oneBBSInfoPO.hits="+bbsHitsCounte;return selectSomeBBSInfo(HQLQuery);}public ArrayList<BBSInfoPO> selectBBSInfoByBBSHits(int firstResult, int maxResults)throws WebBBSException {String hqlSelect="from com.px1987.webbbs.dao.BBSInfoPO as oneBBSInfoPO order by oneBBSInfoPO.hits desc";return pageSelectDBData(hqlSelect, firstResult,maxResults);}public ArrayList<BBSInfoPO> selectBBSInfoByBBSHits() throws WebBBSException { String HQLQuery="from com.px1987.webbbs.dao.BBSInfoPO as oneBBSInfoPO order by oneBBSInfoPO.hits desc";return selectSomeBBSInfo(HQLQuery);}ArrayList allBbsReplyInfosByOneBBS=null;public ArrayList getAllBbsReplyInfosByOneBBS() {return allBbsReplyInfosByOneBBS;}public BBSInfoPO selectBBSInfoByBBSID(int bbsID) throws WebBBSException { BBSInfoPO oneBBSInfoPO=null;Session session=null;Transaction tx=null;try{session = sessionFactory.openSession();tx = session.beginTransaction();oneBBSInfoPO = (BBSInfoPO) session.get(BBSInfoPO.class, new Integer(bbsID));if(oneBBSInfoPO==null) {throw new WebBBSException("在数据库表中不存在指定bbsID="+bbsID+"的数据顶目!");}//只能在同一Session中获得对应的O/R Mapping对象allBbsReplyInfosByOneBBS=oneBBSInfoPO.getBbsReplyInfosByBBS();int bbsHitsCounter=oneBBSInfoPO.getHits();oneBBSInfoPO.setHits(bbsHitsCounter+1);mit();}catch (HibernateException e){int logImpleKind=Integer.parseInt(ClassNameConfig.getProperty("logImpleKind"));this.addObserver(LogInfoFactory.newLogInstance(logImpleKind));this.setChanged(); //注意要设置变化点notifyObservers(e); //当出现异常时将通知各个观察者throw new WebBBSException("在BBSInfoManageDAOHibernateImple类中的SelectBBSInfoByBBSID方法出现了HibernateException异常");}finally{/**由于在Service层中需要应用Lazy加载技术,因此不能关闭SessionHibernateUtil.closeSession();*/}return oneBBSInfoPO;}public ArrayList<BBSInfoPO> selectBBSInfoByBBSSendInfoTime(String sendInfoTime) throws WebBBSException{String HQLQuery="from com.px1987.webbbs.dao.BBSInfoPO as oneBBSInfoPO order by oneBBSInfoPO.hits desc where oneBBSInfoPO.sendInfoTime like '%"+sendInfoTime+"%'";return selectSomeBBSInfo(HQLQuery);}public ArrayList<BBSInfoPO> selectBBSInfoByBBSTitle(String bbsTitleText) throws WebBBSException {String HQLQuery="from com.px1987.webbbs.dao.BBSInfoPO as oneBBSInfoPO order by oneBBSInfoPO.hits desc where oneBBSInfoPO.title='"+bbsTitleText+"'";return selectSomeBBSInfo(HQLQuery);}public ArrayList<BBSInfoPO> selectBBSInfoByBBSTitleID(int bbsTitleID) throws WebBBSException {String HQLQuery="from com.px1987.webbbs.dao.BBSInfoPO as oneBBSInfoPO order by oneBBSInfoPO.hits desc where oneBBSInfoPO.bbsTitleID="+bbsTitleID;return selectSomeBBSInfo(HQLQuery);}public ArrayList<BBSInfoPO> selectBBSInfoByUserID(String userID) throws WebBBSException {String HQLQuery="from com.px1987.webbbs.dao.BBSInfoPO as oneBBSInfoPO order by oneBBSInfoPO.hits desc where erID='"+userID+"'";return selectSomeBBSInfo(HQLQuery);}public ArrayList<BBSInfoPO> selectPageBBSInfoByLoginUserID(String userID, int firstResult, int maxResults) throws WebBBSException{String hqlSelect="from com.px1987.webbbs.dao.BBSInfoPO as oneBBSInfoPO order by oneBBSInfoPO.hits desc where erID='"+userID+"'";return pageSelectDBData(hqlSelect, firstResult,maxResults);}public ArrayList<BBSInfoPO> selectPageBBSInfoByTitleID(int bbsTitleID,int firstResult, int maxResults) throws WebBBSException {String hqlSelect="from com.px1987.webbbs.dao.BBSInfoPO as oneBBSInfoPO order by oneBBSInfoPO.hits desc where oneBBSInfoPO.bbsTitleID="+bbsTitleID;return pageSelectDBData(hqlSelect, firstResult,maxResults);}public ArrayList<BBSInfoPO> selectPageBBSInfoByToday(int firstResult, int maxResults) throws WebBBSException {Date todayDate=new Date();String todayDateString=(todayDate.getYear()+1900)+"-"+(todayDate.getMonth()+1)+"-"+todayDate.getDate();String hqlSelect="from com.px1987.webbbs.dao.BBSInfoPO as oneBBSInfoPO order by oneBBSInfoPO.hits desc where oneBBSInfoPO.sendInfoTime like '%"+todayDateString+"%'";return pageSelectDBData(hqlSelect, firstResult,maxResults);}public boolean updateBBSInfo(BBSInfoPO oneUpdatedBBSInfoPO) throws WebBBSException {boolean OKOrNot=false;Session session=null;Transaction tx=null;BBSInfoPO oneReturnBBSInfoPO=null;try{session = sessionFactory.openSession();tx = session.beginTransaction();oneReturnBBSInfoPO = (BBSInfoPO) session.get(BBSInfoPO.class,new Integer(oneUpdatedBBSInfoPO.getBbsID()));if(oneReturnBBSInfoPO==null){throw new WebBBSException("在数据库表中不存在指定bbsID="+oneUpdatedBBSInfoPO.getBbsID()+"的数据顶目!");}oneReturnBBSInfoPO.setBbsID(oneUpdatedBBSInfoPO.getBbsID());oneReturnBBSInfoPO.setAuthor(oneUpdatedBBSInfoPO.getAuthor());oneReturnBBSInfoPO.setTitle(oneUpdatedBBSInfoPO.getTitle());oneReturnBBSInfoPO.setReplay(oneUpdatedBBSInfoPO.getReplay());oneReturnBBSInfoPO.setHits(oneUpdatedBBSInfoPO.getHits());oneReturnBBSInfoPO.setSendInfoTime(oneUpdatedBBSInfoPO.getSendInfoTime());oneReturnBBSInfoPO.setContent(oneUpdatedBBSInfoPO.getContent());oneReturnBBSInfoPO.setMailto(oneUpdatedBBSInfoPO.getMailto());oneReturnBBSInfoPO.setAbstractText(oneUpdatedBBSInfoPO.getAbstractText());oneReturnBBSInfoPO.setLastUpdateTime(oneUpdatedBBSInfoPO.getLastUpdateTime());oneReturnBBSInfoPO.setBbsIconID(oneUpdatedBBSInfoPO.getBbsIconID());oneReturnBBSInfoPO.setBbsTypeID(oneUpdatedBBSInfoPO.getBbsTypeID());oneReturnBBSInfoPO.setBbsTitleID(oneUpdatedBBSInfoPO.getBbsTitleID());oneReturnBBSInfoPO.setUserID(oneUpdatedBBSInfoPO.getUserID());session.flush();mit();OKOrNot=true;}catch (HibernateException e){int logImpleKind=Integer.parseInt(ClassNameConfig.getProperty("logImpleKind"));this.addObserver(LogInfoFactory.newLogInstance(logImpleKind));this.setChanged(); //注意要设置变化点notifyObservers(e); //当出现异常时将通知各个观察者throw new WebBBSException("在BBSInfoManageDAOHibernateImple类中的updateOneUserInfo方法出现了HibernateException异常");}finally{session.close();}return OKOrNot;}public boolean updateBBSReplyCounterByBBSID(int bbsID) throws WebBBSException { boolean OKOrNot=false;Session session=null;Transaction tx=null;String HQLQuery="update com.px1987.webbbs.dao.BBSInfoPO as oneBBSInfoPO setoneBBSInfoPO.replay=oneBBSInfoPO.replay+1 where oneBBSInfoPO.id="+bbsID;try{session = sessionFactory.openSession();tx = session.beginTransaction();Query query = session.createQuery(HQLQuery);query.executeUpdate();mit();OKOrNot=true;}catch (HibernateException e){int logImpleKind=Integer.parseInt(ClassNameConfig.getProperty("logImpleKind"));this.addObserver(LogInfoFactory.newLogInstance(logImpleKind));this.setChanged(); //注意要设置变化点notifyObservers(e); //当出现异常时将通知各个观察者throw new WebBBSException("在BBSInfoManageDAOHibernateImple类中的updateBBSReplyCounterByBBSID方法出现了HibernateException异常");}finally{session.close();}return OKOrNot;}public boolean updateBBSInfoHitsByBbsID(int bbsID) throws WebBBSException { boolean OKOrNot=false;Session session=null;Transaction tx=null;String HQLQuery="update com.px1987.webbbs.dao.BBSInfoPO as oneBBSInfoPO set oneBBSInfoPO.hits=oneBBSInfoPO.hits+1 where oneBBSInfoPO.id="+bbsID;try{session = sessionFactory.openSession();tx = session.beginTransaction();Query query = session.createQuery(HQLQuery);query.executeUpdate();mit();OKOrNot=true;}catch (HibernateException e){int logImpleKind=Integer.parseInt(ClassNameConfig.getProperty("logImpleKind"));this.addObserver(LogInfoFactory.newLogInstance(logImpleKind));this.setChanged(); //注意要设置变化点notifyObservers(e); //当出现异常时将通知各个观察者throw new WebBBSException("在BBSInfoManageDAOHibernateImple类中的updateBBSInfoHitsByBbsID方法出现了HibernateException异常");}finally{session.close();}return OKOrNot;}public int getBBSInfoCounterBySendTime(String sendInfoTime) throws WebBBSException { String HQLQuery="select count(oneBBSInfoPO) from com.px1987.webbbs.dao.BBSInfoPO as oneBBSInfoPO where oneBBSInfoPO.sendInfoTime like '%"+sendInfoTime+"%'";return getBBSInfoTotalCounter(HQLQuery);}public int getBBSInfoTotalCounter(String HQLQuery) throws WebBBSException{ int totalBBSInfoCounter;Session session=null;Transaction tx=null;Query query =null;try{session = sessionFactory.openSession();tx = session.beginTransaction();query = session.createQuery(HQLQuery);Long objectCounter=(Long)query.uniqueResult();totalBBSInfoCounter=objectCounter.intValue();mit();}catch (HibernateException e){int logImpleKind=Integer.parseInt(ClassNameConfig.getProperty("logImpleKind"));this.addObserver(LogInfoFactory.newLogInstance(logImpleKind));this.setChanged(); //注意要设置变化点notifyObservers(e); //当出现异常时将通知各个观察者throw new WebBBSException("在BBSInfoManageDAOHibernateImple类中的getBBSInfoTotalCounter方法出现了HibernateException异常");}finally{session.close();}return totalBBSInfoCounter;}public int getBBSInfoTotalCounter() throws WebBBSException {String HQLQuery="select count(*) from com.px1987.webbbs.dao.BBSInfoPO";return getBBSInfoTotalCounter(HQLQuery);}public int getHotBBSInfoTotalCounter(int totalHits) throws WebBBSException {String HQLQuery="select count(*) from com.px1987.webbbs.dao.BBSInfoPO as oneBBSInfoPO where oneBBSInfoPO.hits >"+totalHits;return getBBSInfoTotalCounter(HQLQuery);}public int getTotalBBSInfoCounterByUserID(String userID) throws WebBBSException { String HQLQuery="select count(*) from com.px1987.webbbs.dao.BBSInfoPO as oneBBSInfoPO where erID='"+userID+"'";return getBBSInfoTotalCounter(HQLQuery);}public int getBBSTotalCounterInOneBBSTitle(int bbsTitleID) throws WebBBSException{ String HQLQuery="select count(*) from com.px1987.webbbs.dao.BBSInfoPO as oneBBSInfoPO where oneBBSInfoPO.bbsTitleID="+bbsTitleID;return getBBSInfoTotalCounter(HQLQuery);}}3、基于Hibernate3的原生API实现DAO的功能实现(1)类似于普通的Hibernate DAO的功能实现方式这种Hibernate数据访问的风格与我们正常在Hibernate文档和示例中见到的非常类似,不同之处在于DAO的实现类中持有一个SessionFactory 的实例变量。
《J2EE系统架构和程序设计》课程设计实训项目——带有即时通讯功能的BBS系统的测试计划说明书
1.1.1引言
1、编写目的
在开发大型软件的漫长过程中,面对极其错综复杂的问题,人的主观认识不可能完全符合客观现实,与工程密切相关的各类人员之间的通信和配合也不可能完美无缺。
编写本文档的主要目的体现在:
根据软件的功能及结构设计出相应的测试用例,目标在于发现程序中的错误,然后可以加以改正,尽量减低系统运行的故障率,保证系统安全可靠。
本测试计划供测试人员及程序员参考;本文档主要是根据需求说明书中的需求描述,为实施带有Web聊天功能的BBS系统项目测试而编写,用于指导本项目中的系统测试用例编写和系统测试。
本测试计划是为了测试带有即时通讯功能的BBS系统能否正常运行,是否符合用户的基本需求,预期的读者为系统测试人员,系统制作人员和系统使用人员。
2、项目背景
BBS起源于20世纪80年代初,最初只是发布公告消息、讨论问题的在线交流平台,后来,随着网络的普及,论坛功能越来越丰富,各种技术支持,在线服务也在论坛中开展起来。
但是大部分的论坛没有即时聊天功能,这样对于有技术支持,在线服务功能的BBS 的用户(他们需要即时快速的交换信息,例如:如果网站作为一个在线交易论坛,买家往往需要和卖家了解一些商品信息,及买卖双方的讨价还价;一个在线服务论坛,服务人员需要及时的了解用户问题,与用户交流,一步步指导用户解决问题)来说,需要不断的刷新论坛页面以第一时间看到网友回帖。
这样是很不方便的,而且对于一些志同道合的网友想私下聊些话题,只能借助于别的聊天工具,白白的把市场让给其他网络服务公司。
所以我们的选择的项目是做一个带有即时聊天功能的BBS.
为了实现系统功能,我们将BBS分为三个部分完成:论坛前台功能系统、论坛后台管理系统、在线聊天系统。
在线聊天系统是我们BBS的特色功能,在论坛用户的信息支持下的网页聊天系统,可以更好的满足用户的需求,丰富论坛功能。
同是也是对聊天工具网络化的一种新模式的尝
试。
论坛作为一种网络时代的信息传递平台,具有快速,方便,自由等特性。
为了响应和谐社会的号召,保证论坛的健康发展,我们的论坛除了需要管理员手动和谐一些不和谐声音,还需要有一套系统自动和谐一些明显的不良信息,和一套帮助管理员搜索不和谐因素的系统来维持论坛的健康发展。
3、测试的目标
测试是“为了尽可能的发现软件中的错误,而不是为了证明程序的正确性”, 测试的目的就是在软件投入生产性运行之前,按照测试的原则就要求,尽可能多的发现软件中的错误。
4、定义
5、参考资料
1.1.2总体设计
1、测试运行环境
)硬件设备
(1
1)操作系统:采用Windows 操作系统
2)Web服务:Tomcat + JDK1.7
3)数据库:Oracle数据库系统
(3)客户端软件环境
操作系统:Windows 操作系统及任意版本的浏览器2、被测试的系统功能点说明
被测系统前台功能点的输入、输出、预期结果参考
1.1.3测试计划
1、所使用的自动化测试工具
2、测试目的和任务
针对论坛网站系统进行全面测试,系统测试环境的建立和测试活动安排在小组内部。
依据软件功能对整个系统的各个功能模块进行测试,保证系统代码编写质量符合需求规格说明书要求和用户验收要求。
3、测试安排和进度(时间和人员安排)
4、条件
5、测试约束
测试应交付的测试工作产品如下,每次测试都需要填写测试记录、问题清单、评估报
告。
(1)《测试计划》BBSCS001
(2)《测试用例》BBSYL001
(3)《测试分析报告》BBSCSFX001
6、测试方案
测试方案是测试阶段的关键技术问题。
为了提高测试效率降低测试成本,本测试方案采用黑盒法设计基本的测试方案。
在黑盒法测试方案中,采用等价划分技术,把所有可能的输入数据(有效的和无效的)划分成几等价类,其划分类在以下的输入中再详述。
7、测试准备
在测试前,与各模块的主要负责人共同协商讨论,以概要设计说明书、详细设计说明书作为总的提纲,选择合适的输入输出数据,并加以意义列举说明。
1.1.4评价准则
1、范围
本系统测试的主要内容包括功能测试、界面测试、安全测试。
2、数据整理
执行测试,所有测试的有关操作和结果填写进测试报告,对测试结果进行分析,提交测试分析报告。
3、尺度
对系统测试结果的评判是以测试用例设计中的预期测试结果为评价标准,系统的测试缺陷主要分为如下的四类。
(1)1类
测试用例正确执行,与期待输出结果一致,没有发现任何错误。
(2)2类
能正确完成功能要求,但测试用例执行过程中出现一些界面、提示、使用不方便等方面的问题,对于这些问题一般不需要做进一步处理,往往可以忽略。
(3)3类
能正确完成主要测试功能点,不能正确完成某些次要功能点,或不能正确处理某些出现概率较小的特殊输入组合,此类问题应不影响测试用例整体的正确性。
(4)4类
不能完成测试用例所要检查的主要功能,或虽有此功能但出现的错误将引发大量的补
救措施。
4、评价准则
严格遵循需求文档的要求,建立严密的修改回溯体组织。
1.1.5测试基本内容
1、系统功能测试
(1)概述
确保测试的功能正常,如数据输入、处理、检索是否正确,以及业务规则的实施是否恰当。
即对交互的输出或结果进行分析,以此来核实应用程序及其内部进程。
(2)目标——利用有效的和无效的数据来执行各个用例,以核实以下内容:
1)在使用有效数据时得到预期的结果
2)在使用无效数据时显示相应的错误消息或警告消息。
(3)单一界面测试的参考表格如下
(4)具体功能测试参考标准表格如下
2、用户界面测试
(1)概述
用于核实用户与软件之间的交互是否正常
(2)目标——核实下列内容
1)确保各种浏览以及各种访问方法(鼠标移动、快捷键等)都使用正常
2)确保窗口对象及其特征(菜单、大小、位置、状态和中心)都符合标准等(3)参考表格如下
3、性能测试
(1)概述
主要是对响应时间、事务处理速率和其他与时间相关的需求进行评测和评估。
性能评测的目标是核实性能需求是否都已满足。
(2)目标——核实下列情况下的性能行为
1)正常的预期工作量
2)预期的最繁重工作量
(3)参考表格如下
4、压力测试
(1)概述
这里的具体包含了负载测试以及压力测试。
(2)目标——核实下列行为下的系统行为
1)确定测试对象在给定时间内能够持续处理的最大负载或工作量(包括长时间处理多
个用户相同的且性能最坏的业务)
2)确定并确保系统在超出最大预期工作量的情况下仍能正常运行,并评估其性能特
征,包括响应时间、事务处理速率和其他与时间相关的内容
(3)执行步骤
1)步骤一:执行单步任务测试
2)步骤二:多用户多任务测试
(4)参考表格如下——单步任务参考表格
(5)多用户多任务测试参考表格
5、故障恢复测试
(1)概述
确保系统能从各种意外数据损失或完整性破坏的各种软/硬件故障中恢复。
(2)目标——核实系统能够在下列状况下正确恢复到预期的已知状态。
1)客户/服务机断电
2)网络通信中断
3)异常关闭某个功能
4)错误的操作顺序
(3)参考表格如下
6、配置测试
(1)概述
核实测试对象在不同的软件和硬件配置中的运行情况。
(2)目标——确定系统能在下列条件下正常运行
1)在各种所需的硬件和软件配置中
2)在各种O/S平台或是浏览器下的兼容性测试
(3)相关表格如下。