基于Robot Framework 的自动化测试系统的设计与实现

 2022-06-21 11:06

论文总字数:27052字

摘 要

现如今,软件技术迅猛发展,使得软件产品被应用到社会的各个领域。同时,全球日益激烈的软件技术竞争,使得人们对软件质量的要求也越来越高。软件测试成为了保障软件质量和安全的重要手段。对于公司第三方支付平台资金管理系统这类长期性的软件产品,随着软件产品规模的不断扩大和复杂性的不断提高,纯粹的手工测试成本高、效率低、发现缺陷晚等缺点已经不能满足实际测试工作的需求。而自动化测试能有效提高测试效率和测试维度,弥补手工测试的不足。因此,自动化测试技术的研究和应用具有非常重要的理论和实践意义。

本文在对几种主流的自动化测试框架和工具进行分析和比较的基础上,设计并实现了一套基于Robot Framework的混合型测试框架的自动化测试系统,充分利用了关键字驱动和数据驱动技术的优势,实现了测试数据、测试逻辑、测试脚本三者的分离。该系统引入了“层次化关键字”和“MVC软件设计模式”的思想,提高了测试脚本的复用性,降低了测试脚本的维护开销。同时,该系统结合“对象关系映射”的思想,实现了业务对象与数据库的分离,简化了对数据库的操作。

最后将该系统应用于公司资金管理系统的自动化回归测试,通过对其手工测试用例覆盖率、执行效率和系统稳定性等指标的统计,并将其与传统手工测试和原有自动化测试系统相比较,最终证明该系统拥有良好的性能。

关键词:自动化测试,Robot Framework,混合型测试框架,层次化关键字,对象关系映射

ABSTRACT

Nowadays, the rapid development of software technology has made software products applied to all fields of society. At the same time, the increasingly fierce global competition in software technology has made people increasingly demanding software quality. Software testing has become an important means of ensuring software quality and security. For long-term software products such as the company's third-party payment platform money management system, as the scale of software products continues to increase and the complexity continues to increase, the shortcomings of high cost, low efficiency, and late discovery of defects in pure manual testing can no longer meet the needs of actual test work. The automated test can effectively improve the test efficiency and test dimensions, and make up for the lack of manual testing. Therefore, the research and application of automated testing technology has very important theoretical and practical significance.

Based on the analysis and comparison of several mainstream automated testing frameworks and tools, this paper designs and implements an automated testing system based on Robot Framework's hybrid testing framework. It makes full use of the advantages of keyword-driven and data-driven technologies to achieve the separation of test data, test logic, and test scripts. The system introduces the idea of "Hierarchical Keywords" and "MVC software design pattern", which improves the reusability of test scripts, and reduces the maintenance overhead of test scripts. At the same time, the system combines the idea of "Object-Relational Mapping" to achieve the separation of business objects and databases, simplifying the operation of the database.

Finally, the system was applied to the automated regression test of the company's money management system. Through the statistics of its manual test case coverage, execution efficiency, and system stability, and comparing it with the traditional manual test and the original automated test system, it finally proves that the system has good performance.

Keywords: automated test, Robot Framework, hybrid test framework, Hierarchical Keywords, Object-Relationship Mapping

目 录

摘 要 I

ABSTRACT II

第一章 绪论 1

1.1课题的背景和意义 1

1.2国内外研究现状 1

1.3研究内容与组织结构 2

第二章 软件自动化测试技术 3

2.1软件测试概念 3

2.2软件自动化测试基础 3

2.2.1自动化测试概念 3

2.2.2自动化测试的特点 3

2.3自动化测试框架 4

2.3.1录制/回放测试框架 4

2.3.2数据驱动测试框架 4

2.3.3关键字驱动测试框架 4

2.3.4混合型测试框架 4

2.4自动化测试工具 5

2.4.1自动化测试工具介绍和比较 5

2.4.2 Robot Framework框架简介 5

第三章 需求分析与概要设计 7

3.1自动化测试系统需求分析 7

3.1.1功能需求分析 7

3.1.2非功能性需求分析 7

3.2原有自动化测试系统分析 8

3.3自动化测试系统概要设计 8

3.3.1自动化测试系统总体架构 8

3.3.2自动化目录结构 9

3.3.3系统组网结构图 10

第四章 自动化测试系统详细设计与实现 11

4.1关键字库的设计与实现 11

4.1.1原有关键字库分析 11

4.1.2层次化关键字设计 12

4.1.3层次化关键字的实现 12

4.1.4关键字库的优化 18

4.2测试用例组织与实现 19

4.2.1测试用例的组织结构 19

4.2.2测试用例的实现规范 20

4.2.3测试用例的实现 20

4.3测试数据文件的设计与实现 21

4.4支持工具 22

第五章 自动化测试系统的应用与评估 24

5.1自动化测试系统的应用 24

5.2自动化测试系统的评估 26

5.2.1手工测试用例覆盖率评估 26

5.2.2测试执行效率评估 27

5.2.3测试系统稳定性评估 28

第六章 工作总结及展望 29

6.1总结 29

6.2展望 29

致 谢 30

参考文献 31

第一章 绪论

1.1课题的背景和意义

软件技术的迅猛发展,使得软件产品被广泛应用到社会的各个领域中,人们对软件质量的要求也不断提高。然而,百分之百完美的软件是不存在的[1],软件缺陷(常被称为“Bug”)致使软件在某一特定条件下出现故障[2]。各种缺陷带来的影响是不一样的,有的可能仅仅是不美观,而有的却可能是灾难性的。随着软件规模的扩大、复杂度的提高,软件开发周期的不断缩短,软件质量的保证成了一件异常困难的事情。软件测试贯穿于整个软件过程,为软件质量和安全提供了重要保障。

软件测试按测试手段可分为手工测试和自动化测试。手工测试即人为的、手动的执行测试用例,验证软件的正确性;自动化测试即利用测试工具自动完成测试工作。手工测试是软件测试早期的主要形式[3]。然而,公司的第三方支付平台资金管理系统(以下简称“资金管理系统”)是一个长期的系统,随着软件技术和业务需求的变化,可能需要进行增加新的功能模块、删除部分原有模块等修改,所以需要多次进行回归测试[4];同时,其上游面向商户并提供支付服务接入,下游面向合作伙伴——商业银行,集成银行现有的支付服务。该系统涉及用户的支付、转账等资金处理业务,直接关系着用户资金和个人信息的安全,因此对软件质量有着更高的要求。所以,纯粹通过传统的手工测试很难按时完成规定的测试工作,并且需要大量的测试人员和测试时间。并且,手工测试几乎难以完成负载测试、强度测试、并发测试、压力测试等系统性能测试[5]

剩余内容已隐藏,请支付后下载全文,论文总字数:27052字

您需要先支付 80元 才能查看全部内容!立即支付

该课题毕业论文、开题报告、外文翻译、程序设计、图纸设计等资料可联系客服协助查找;