微型电脑应用2024,Vol.40Issue(2) :29-32.

一种数据驱动的Web自动化测试组件的设计

Design of a Data-driven Web Automation Test Component

李宝智 张绛丽 陈孟祥 张毅 肖新凤
微型电脑应用2024,Vol.40Issue(2) :29-32.

一种数据驱动的Web自动化测试组件的设计

Design of a Data-driven Web Automation Test Component

李宝智 1张绛丽 1陈孟祥 1张毅 1肖新凤1
扫码查看

作者信息

  • 1. 广东环境保护工程职业学院,先进制造学院,广东,佛山 528216
  • 折叠

摘要

在Web测试过程中,某些步骤所涉及的页面操作比较多,测试人员需要根据页面DOM的结构和填充的数据重新构建测试代码的挑战.这样增加了测试人员的工作强度和代码编写的工作量.每一次的页面测试基本都可以归纳为查找页面元素和处理元素动作.将自动化测试组件进行二次封装,可以减少测试过程中的重复代码编写,让开发人员专注于测试过程的数据编制.介绍一种在Python环境下,以外部数据驱动WebDriver实现自动化测试的组件的设计与实现方法.该方法将页面操作的动作和填写的信息保存在外部数据文件中,将常用的执行动作和填写的数据组合为页面操作的过程封装为一个组件.利用此套组件,可以实现"数据-操作-代码"的分离,大大减少了测试人员的开发代码量.

Abstract

During the Web testing process,certain steps involve a significant number of page operations.Testers need to recon-struct test code based on the structure of the page's Document Object Model(DOM)and the data being filled.This increases the workload for testers and the amount of code to be written.Each page test can generally be summarized as follows:locating page elements-performing element actions.By encapsulating automation test components,the redundancy in code writing dur-ing the testing process can be reduced,allowing developers to focus on data preparation for the testing process.This article in-troduces a method for designing and implementing components for automated testing using WebDriver driven by external data in the Python environment.This method stores the actions of page operations and the information filled in external data files,combining common execution actions and data filling into a component encapsulating the process of page operations.By using this set of components,the separation of"data-operation-code"can be achieved,greatly reducing the amount of code develop-ment for testers.

关键词

自动化测试/Web测试/Selenium/组件

Key words

automated testing/Web testing/Selenium/component

引用本文复制引用

基金项目

粤高职计算机教指委教育教学改革研究与实践项目(JSJJZW2021058)

广东省教育厅高等职业教育教学质量与教学改革工程项目(GDJG202151)

广东省职业院校教学能力与教育技术工作指导委员会教育教学改革研究与实践项目(JXNLJG202118)

出版年

2024
微型电脑应用
上海市微型电脑应用学会

微型电脑应用

CSTPCD
影响因子:0.359
ISSN:1007-757X
参考文献量9
段落导航相关论文