轻量级j2ee架构软件的单元测试策略和方法研究

上传人:w****i 文档编号:117531456 上传时间:2019-12-05 格式:PDF 页数:72 大小:2.66MB
返回 下载 相关 举报
轻量级j2ee架构软件的单元测试策略和方法研究_第1页
第1页 / 共72页
轻量级j2ee架构软件的单元测试策略和方法研究_第2页
第2页 / 共72页
轻量级j2ee架构软件的单元测试策略和方法研究_第3页
第3页 / 共72页
轻量级j2ee架构软件的单元测试策略和方法研究_第4页
第4页 / 共72页
轻量级j2ee架构软件的单元测试策略和方法研究_第5页
第5页 / 共72页
点击查看更多>>
资源描述

《轻量级j2ee架构软件的单元测试策略和方法研究》由会员分享,可在线阅读,更多相关《轻量级j2ee架构软件的单元测试策略和方法研究(72页珍藏版)》请在金锄头文库上搜索。

1、国防科学技术大学 硕士学位论文 轻量级J2EE架构软件的单元测试策略和方法研究 姓名:全华 申请学位级别:硕士 专业:计算机技术 指导教师:尹俊文 2010-05 国防科学技术大学研究生院工程硕士学位论文 第 i 页 摘 要 随着世界新军事变革的不断推进和我军信息化建设的不断深入,军队信息技 术水平也得到快速提高。各类信息软件系统在我军各部队得到广泛应用,尤其是 轻量级 J2EE Web 架构的军用软件逐渐在作战指挥、教学训练、后勤保障等各个重 要领域普及,使之成为我军信息系统的关键组成部分之一。软件测试是保障软件 质量的重要手段,如何对此类软件系统进行便捷有效的单元测试日益成为迫切需 要解决

2、的新课题。 目前针对面向对象单元测试的工具、技术和方法很多,但没有统一的规范和 标准, 在工程实际开发过程中难以操作和实施, 更没有一套比较完善的轻量级 J2EE Web 架构软件系统单元测试的策略和方法。 针对这一问题,本文根据对软件质量保证、软件测试和单元测试等基本理论 的研究和对轻量级J2EE架构特点的分析, 结合武器存贮信息系统单元测试的实践, 探讨了基于轻量级 J2EE Web 架构的军用软件的单元测试应采取的策略和方法。 通过对三种单元测试的基本方法进行可行性分析,选择了使用开源测试框架 进行测试的方法;对 Maven 和 Ant 两种主流项目构建工具进行对比,选择了使用 Mave

3、n 进行单元测试的构建工具;对 JUnit 独立对 J2EE 单元测试的困难和不足进 行分析,得出应在使用 JUnit 基础框架的同时,结合其它能有效测试各层组件和代 码的开源框架共同进行 J2EE 的单元测试的方法。 对武器存贮信息系统的单元测试进行具体分析,确定了需要测试的代码。对 武器存贮信息系统进行单元测试的实践, 使用 JUnit 框架, 并且在表示层结合 Canoo 和 Spring Mock, 在业务逻辑层结合 jMock, 在持久层结合 DbUnit 编写单元测试用 例,然后自动化运行了所有单元测试用例。最后,对轻量级 J2EE Web 架构应用系 统的单元测试进行总结,形成了

4、单元测试的策略和方法、测试的步骤等结论,对 其此类军用软件系统的单元测试具有一定的借鉴意义。 关键词:单元测试,轻量级 J2EE,构建工具,测试框架 国防科学技术大学研究生院工程硕士学位论文 第 ii 页 ABSTRACT With the continuous improvement of military reform and informatization construction, the level of military information technology has been raised as well. Each kind of software has been wi

5、dely used in each troop of PLA. Especially the military software of lightweight J2EE Web architecture has been gradually popularized to each significance areas like operational commanding, teaching training and logistic supporting, making it one of the key components of our armys information system.

6、 Software testing is an important method to guarantee software quality. How to do unit testing of this kind of software in a more convenient and efficient way is increasingly becoming a new issue needing solving urgently. At present, there are many tools, technologies and methods of unit testing but

7、 not a unified standard, which makes it difficult to operate and implement in actual engineering development processes, much less a relatively thorough unit testing strategy and method for lightweight J2EE Web architecture software system. To solve this problem, this paper discussed the strategies a

8、nd methods should be taken for the unit testing in lightweight J2EE Web architecture military software based on the research of basic theories of software quality guarantee, software and unit testing and on the analysis of lightweight J2EE architecture features combining with the unit testing practi

9、ce of weapon storage information system. Open source testing framework is chosen to test on the feasibility analysis of three kinds of basic methods in unit testing. Maven is used as the build tool in unit testing after the comparison between the two main program build tools - Maven and Ant; after a

10、nalyzing the difficulties and deficiencies in Junits independently doing unit testing of J2EE, we come to the conclusion of combining other open source framework which can efficiently test each layer components and codes with Junit framework. The codes, which need testing, are determined according t

11、o the specific analysis of the unit testing of weapon storage information system. In the practice of unit testing of weapon storage information system, JUnit framework is used, Canoo and Spring Mock is integrated into the presentation layer, DbUnit into the Persistence Layer to write unit testing ex

12、amples, and then all the unit testing examples are run automatically. At last, this paper summarize the unit testing of lightweight J2EE Web architecture application system to reach the conclusion for the strategy and method, procedures of unit testing, which is significance for unit testing of othe

13、r similarly military software system. Keywords: Unit testing, Lightweight J2EE, Build tools, Testing frameworks 国防科学技术大学研究生院工程硕士学位论文 第 IV 页 表 目 录 表 4.1 一个简单的 build.xml 文件 25 表 4.2 Ant 常用命令 26 表 4.3 一个简单的 pom.xml 文件. 27 表 4.4 Maven 常用命令. 28 表 4.5 EasyMock 与 jMock 的参数比较. 38 国防科学技术大学研究生院工程硕士学位论文 第 V 页

14、图 目 录 图 2.1 质量保证构成.5 图 2.2 测试数目举例.6 图 2.3 应用程序开发阶段与测试类型7 图 2.4 各种测试的时间比较.9 图 2.5 应用程序内部的单元测试. 10 图 2.6 黑盒测试覆盖率. 11 图 2.7 白盒测试覆盖率. 11 图 3.1 经典 J2EE 架构体系结构图. 14 图 3.2 轻量级 J2EE 架构结构图. 16 图 3.3 Spring 的核心模块. 17 图 3.4 Spring MVC 的生命周期 . 18 图 3.5 Hibernate 的总体结构图 20 图 4.1 Ant 目标的依赖关系 25 图 4.2 Maven 如何解决外部

15、依赖关系 26 图 4.3 Maven 生命周期阶段. 27 图 4.4 Junit 的核心类框图 33 图 5.1 某部队网络结构图. 41 图 5.2 武器存贮信息系统层次结构图 42 图 5.3 部分要测试的 JSP 树结构截图 43 图 5.4 部分要测试的控制器树结构截图 44 图 5.5 部分要测试的业务逻辑层类树结构截图 44 图 5.6 部分要测试的持久层 DAO 类树结构截图 45 图 6.1 在 Maven 执行单元测试的结果. 59 图 6.2 surefire- reports 目录下生成的 XML 和 TXT 报告列表. 59 图 6.3 surefire- repo

16、rt.html 显示的单元测试结果 60 国防科学技术大学研究生院工程硕士学位论文 第 1 页 第一章 绪论 1.1 论文的研究背景论文的研究背景 随着世界新军事变革的不断推进和信息技术的快速发展,世界各主要军事强 国都致力于建设现代信息化军队,制信息权成为夺取未来战场主动权的决定因素, 直接决定未来战争的胜负,信息系统作为战场纷繁复杂信息的“管理者”,其质 量的高低影响着信息的获取、传递、处理和使用的全过程,因此,从某种意义上 说,信息系统的可靠与否,对于夺取战场的制信息权有着举足轻重的作用。 军用软件是指军队为遂行作战任务或业务管理需要而使用的软件系统,主要 包括军事指挥系统、业务管理系统和信息化武器装备控制系统。随着我军信息化 建设的不断深入,军用软件的规模和数量空前增长,其中有许多基础的、优秀的 军用软件在部队得到广泛应用,有一些已列入装备,在我们的日常训练、管理和 后勤工作中发挥着重要作用,包括:为实现信息化条件下一体化联合作战指挥研 制的联合作战指挥信息系统、全军各级各部门为提高业务管理水平和质量效能研 制的业务管理信息系统。各类信息化装备不断研制成功并装备部队,其本

展开阅读全文
相关资源
相关搜索

当前位置:首页 > 办公文档 > 其它办公文档

电脑版 |金锄头文库版权所有
经营许可证:蜀ICP备13022795号 | 川公网安备 51140202000112号