RobotFramework环境配置十六:数据驱动(Read Data From Excel)
来源:互联网 发布:hexo highlight.js 编辑:程序博客网 时间:2024/05/04 08:40
数据驱动
RIDE提供的库:
- Create List
- Get File
- Import Variables
- Template
- ExcelLibrary
自定义库:DataCenter.py
- Read Data From Excel
- Read Excel File
- Read CSV File
- Read Column From Excel
- Get Sheet Values From Excel
一、数据驱动测试注重于测试软件的功能性需求,也即数据驱动测试执行程序所有功能需求的输入条件。实现KISS。
二、Read Data From Excel 方法
还是以登录测试为例讨论Read Data From Excel 方法。
导入自定义库文件 data_center.py
目录:F:\Robotframework\common\library
数据源
有关Excel数据源的问题,请参考个人博客数据驱动(ExcelLibrary)
用例:Demo004_Login_Excel
- 读取Excel文件:Read Data From Excel
- 登录网站:GUI_Login
- 断言:用户名与密码是否正确
比较 ExcelLibrary 方法
缺点:其读取方式是读取的每一项内容都会加上列名,对于数据的处理不是特别优雅。
如何处理读取方式?我们可以修改ExcelLibrary进行简化。不过,本文以自己创建data_center.py库来实现对Excel的读取。源代码如下:
数据存储listAll中,是以二位列表方式存储;alist是各列数据。如下图所示:
PS:
1. 关于处理Excel整数变浮点数的问题:python读取Excel文件后,如何处理浮点数的问题请查看个人博客数据驱动(ExcelLibrary)
2. 关于用json处理完list,tuple和dict中乱码之后产生的问题:无法以列表,元组和字典的方式读取数据,请查看个人博客中文日志乱码问题
0 0
- RobotFramework环境配置十六:数据驱动(Read Data From Excel)
- RobotFramework环境配置十九:数据驱动(Read Column From Excel)
- RobotFramework环境配置十七:数据驱动(Read Excel File)
- RobotFramework环境配置十八:数据驱动(Read CSV File)
- RobotFramework环境配置二十:数据驱动(Get Sheet Values From Excel)
- RobotFramework环境配置二十一:数据驱动(总结)
- RobotFramework环境配置二十三:创建报告(Excel文件)
- Robotframework环境搭建二十六:设置日志目录(续)
- Robotframework 写入excel数据
- RobotFramework环境配置二十四:创建报告(Excel文件)续
- Robotframework(1):配置基础环境
- robotframework 环境配置
- robotFramework 读取Excel文件数据
- pandas read data from files
- RobotFrameWork(七)数据驱动之Template模板
- python+robotframework --环境安装+配置
- Read and Display Data From an Excel File (.xsl or .xlsx) in ASP.NET
- Read Excel files from Python
- Vickate_iOS_文件预览QLPreviewController(pdf,excel,word等)
- Android调用微信原生分享接口,进入微信分享界面返回不了!
- HTTP中application/x-www-form-urlencoded字符说明
- WithEvents
- go语言list循环删除元素(转载)
- RobotFramework环境配置十六:数据驱动(Read Data From Excel)
- Android Studio MAT内存分析初探
- error :dereferencing pointer to incomplete type解决办法
- 1048
- 使用ndk工具链创建在安卓机器上的可执行文件
- matplotlib去掉边框
- jquery实现内容的折叠与展开
- WebService对象可空、nillable、minOccurs 、转xml字段丢失
- Java WebService 简单实例