《电子技术应用》
您所在的位置:首页 > 其他 > 设计应用 > 一种基于Selenium与Unittest的Web自动化测试框架
一种基于Selenium与Unittest的Web自动化测试框架
信息技术与网络安全
单攀攀
(上海维也知科技责任有限公司,上海201106)
摘要: 由于产品需求的频繁变更或功能缺陷的不断迭代,出现了大量的软件回归测试中占用测试人力资源来保证产品质量的现象。针对这一现象,设计并实现了一种基于Selenium与Uunittest的Web自动化测试框架。使用基于Python的Unittest测试框架,能够非常容易地插入、设置与分解相关的测试功能。同时结合了Selenium,把常用的操作和查找封装成基础类,针对不同的产品或项目,可直接复用。使用该自动化测试架构,不仅减少了回归测试的人力成本,也减少了对测试人员在自动化测试开发脚本能力的要求。
中图分类号: TP311.5
文献标识码: A
DOI: 10.19358/j.issn.2096-5133.2021.09.013
引用格式: 单攀攀. 一种基于Selenium与Unittest的Web自动化测试框架[J].信息技术与网络安全,2021,40(9):77-80.
An web automated testing framework based on unittest and selenium
Shan Panpan
(Shanghai Wei Yi Zhi Technology Limited Liability Company,Shanghai 201106,China)
Abstract: Due to the frequent changes of product requirements or the continuous iterations of functional defects, a large number of software regression testing take up testing human resources to ensure product quality. In view of this phenomenon, this paper designs and implements an web automated testing framework based on selenium and unittest. Using the Python based unittest test framework, it is very easy to insert and set the test functions related to decomposition. Combined with selenium, this test architecture encapsulates common operations and searches into basic classes, which can be reused directly no matter what product or project it is. The use of this automated testing architecture not only reduces the human cost of regression testing, but also reduces the requirements of testers for automated test development script ability.
Key words : Unittest;Selenium;autotest platform

0 引言

软件测试是为了提高软件系统可靠性,保障软件系统质量而存在。IEEE、ACM等组织制定了一系列的软件测试流程标准。Carnegie Mellon主要进行了基于关键字驱动模型自动化测试的研究[1]。伴随着互联网技术的发展和自动化测试工具与方法的不断完善和扩展,自动化测试技术越来越成为了当前软件工程领域的热门研究方向之一。

现今越来越多的企业应用在使用B/S架构[2](即Web),B/S架构解决了C/S架构存在的部分问题,不仅没有客户端的差异,而且用户只需要安装浏览器,不需要再额外安装客户端应用。假如应用的业务需求有所变更,仅仅将服务器端的应用程序进行更新即可。另外,客户端应用将不会受限于操作系统的区别,当前主流的浏览器往往在多种操作系统下都有对应的版本可供使用。

随着市场Web应用的不断扩充,Web平台的自动化测试或为软件自动化测试的主要组成内容,目前软件行业也在该方面取得了一些研究硕果。Throught Works公司研发了一系列开源的Selenium Web平台的功能测试工具集,普遍应用于各式各样的Web平台自动化测试,其中特性不仅具有方便扩展、可跨平台,还可支持多浏览器等。Selenium被诸多自动化Web测试框架所使用,最近几年来已有众多基于Selenium的Web自动化测试框架的研究成果逐渐被引起重视[3-4]。

在实际应用和实施过程中,自动化测试的框架与方法使用的越优良,其长期应用所取得的收益也就越显著。其中自动化测试的核心技术主要是设计与使用自动化测试框架,不适用的测试框架不能顺利开展良好的自动化测试,即造成人力成本输出,也不能保障产品质量。



本文详细内容请下载:http://www.chinaaet.com/resource/share/2000003770




作者信息:

单攀攀

(上海维也知科技责任有限公司,上海201106)




微信图片_20210517164139.jpg

此内容为AET网站原创,未经授权禁止转载。