摘 要
在现今的软件测试教学中,依然偏重于理论的教学,实践教学的缺乏是影响学生软件测试能力的主要因素。在软件工程中,软件测试的地位越来越重要,设计软件测试用例的优劣,对学生以后项目开发至关重要。目前软件测试实践还限制于设备环境,要完成测试,学生需要安装针对不同语言和不同测试类型的测试工具,且对于测试的结果的评判也限制于人工评判,由于测试结果分散在各自的环境中也不利于汇总分析。所以本论文希望设计一款系统,该系统能够接收用户提交的测试用例脚本,然后由测评机对测试用例进行分析并给出评价结果。
目前有许多的在线测评系统,但是大部分是用来判断代码程序的正确性,及代码执行过程中的信息参数。目前市场上有许多优秀的软件测试框架和工具,但是需要安装环境,且测试结果也不便于持久保存。所以本系统拟结合两者来实现一款软件测试用例在线评判系统,参照目前流行的在线判题系统的原理,使用Web开发技术完成开发。利用合适的软件测试工具作为测评机的开发基础,将软件测试工具整合到测评机中,实现对软件测试用例的测评,目前对测试用例的测评以覆盖率为标准,二者通过ApacheMQ发送异步消息进行通信。
为了实现扩展的方便,本系统采用Web端和测评机相互分离的策略。测评机对测评实现进行了抽象封装,扩展只需要实现测评接口,配置对应的测试环境。
本文的主要工作分三个部分:
(1)确定需求,明确架构。根据目前软件测试教学中存在问题以及测试工具和测试方法的不足,确定系统的需求,系统的核心需求是实现在线测评测试用例;根据需求明确系统的架构,一方面,本系统要实现一个在线测评的功能,所以系统采用Web开发满足在线提交管理;另一方面测评是系统的核心,所以将其与Web端分离开发。因此系统大体架构类似B/S结构:B为Web端,S为测评机。
(2)系统设计与实现。详细设计系统各功能模块的结构及实现流程、用户操作界面、数据库以及主要程序模块的实现方式。
(3)系统测试。根据需求设计测试方案完成测试并对测试结果进行分析,验证系统的实现情况。
关键词:在线评判;测评机;覆盖率;消息通信;Web开发
Abstract
In the teaching of software testing in today, teacher still place extra emphasis on the theory of teaching. For students, the ability to design test cases is not effectively exercised. Software testing, as an important subject area in software engineering, is critical in practical project development. At present, the practice of software testing is also limited to the device environment. If students want to complete the test, students need to install a variety of test tools for different languages and different test types. The test results are also limited with the evaluation of artificial. The test results and their respective environment is also not conducive to statistics. Therefore, this paper hopes to design a system which can achieve the online evaluation of test case.
There are many online evaluation systems, but most of them are used to judge the correctness of the code program and get the parameters in the time of code execution. There are many frameworks and tools for software testing, but the installation environment is required and the test results are not easy to keep lasting. Therefore, this system intends to combine OJ and Web development to achieve an online software test case judgments. With referencing to principle of the current popular OJ system and the application of Web development technology to complete the development of the Web. The appropriate software testing tools integrated into the evaluation machine to achieve the evaluation of software test cases. The current evaluation of the task is mainly on the coverage of the statistics. The Web and the evaluation machine send asynchronous message via Apache ActiveMQ for communication each other.
In this system, the Web and the evaluation machine are separated from each other, so the expansion is more convenient. The web almost is no need to modify, and only need to modify the evaluation machine. The evaluation machine abstracts and encapsulates the evaluation implementation. The expansion only need to achieve evaluation interface and configure the corresponding test environment.
The main work of this paper is divided into three parts.
Identifying requirements and clarifying the structure. Determining the needs of the system according to the current problems in software testing and the lack of test tools and test methods. In general, the core need of the system is to achieve the online evaluation of test case; Designing the system architecture according to the needs of the system. On the one hand, the system need to achieve an online evaluation of the function, so the system uses Web development to meet the needs of the submission and management online; on the other hand, the evaluation is the core of the system, so it will be separated from the Web side development. So the system architecture is similar to the B / S structure: the B is the Web side and S is the evaluation machine.
In the aspect of the design and implementation, I designed the structure and implementation of each function module of the system, the user interface, the database and the realization of the main program module in detail.
At the test stage, in order to verify whether the system is meeting the needs, I design the test program to test the system according to the needs. After finishing the test, I analyze the results of the test and determine the completion of the system.
Keywords: Online Evaluation; Evaluation Machine; Coverage; Message Communication; Web Exploit
目 录
图清单 I
表清单 III
第一章 绪论 1
1.1 研究背景和意义 1
1.2 国内外研究现状 1
1.3 研究目标和内容 2
1.4 论文的组织结构 3
第二章 技术支持 5
2.1 开发平台及框架 5
2.2 消息通信ActiveMQ 6
2.3 覆盖率统计 7
2.3.1 Java覆盖率统计 7
2.3.2 Python覆盖率统计 10
2.4 其他技术 11
2.4.1 Ant 11
2.4.2 Jsoup 11
2.4.3 Beetl 11
2.5 本章小结 12
第三章 系统需求分析和结构设计 13
3.1 需求分析 13
3.1.1 系统目标 13
3.1.2 功能需求 13
3.1.3 系统非功能性需求 14
3.2 系统结构设计 14
3.2.1 逻辑架构 14
3.2.2 物理架构 16
3.2.3 功能结构 16
3.3 本章小结 17
第四章 系统详细设计 18
4.1 系统功能模块设计 18
4.1.1 系统管理模块 18
4.1.2 系统维护模块 20
4.1.3 单元测试模块 20
4.2 用户界面设计 21
4.2.1 设计原则 21
4.2.2 界面设计 22
4.3 数据库设计 26
4.4 系统开发结构设计 27
4.3.1 技术结构 27
4.3.2 静态包结构 28
4.5 程序模块设计 29
4.6 安全设计 31
4.5.1 用户权限划分 31
4.5.2 数据的一致性 31
4.7 本章小结 31
第五章 系统实现和测试 32
5.1 系统整体实现 32
5.2 关键技术实现 33
5.2.1 代码生成 33
5.2.2 消息通信 34
5.2.3 测评机 35
5.2.4 获取实时测评结果 36
5.3 系统测试 37
5.3.1 测试环境与测试方案 37
5.3.2 系统测试数据与流程 38
5.3.3 系统测试结果与分析 43
5.4 本章小结 45
第六章 总结和展望 46
6.1 总结 46
6.2 展望 47
致谢 48
参考文献 49