介绍
下面介绍一款Robot Framework(以下简称RF)测试指标的可视化Dashboard工具robotmetrics
效果如下图所示:

robot metrics
安装使用
工作原理
- 使用RF的API读取RF的输出文件output.xml
- 使用API获取Suite, Test Case, Keyword, Status, Start Time, End Time以及Elapsed time值
- 使用BeautifulSoup库将数据生成html 报告
在工程中使用
- 从github仓库中下载
robotmetrics.py
文件 - 将
robotmetrics.py
文件拷贝到工程项目中 - 安装
beautifulsoup
库pip install beautifulsoup4
- 执行
robotmetrics.py
文件
案例1:`robotmetrics.py`文件与`output.xml`文件在同目录
python robotmetrics.py
案例2:指定`output.xml`文件路径
python robotmetrics.py -inputpath .\Result\
案例3:指定文件名称
python robotmetrics.py -inputpath .\Result\ -output voutput.xml -report vreport.html -log vlog.html
- Robot Framework指标报告
metric-timestamp.html
会生成在指定的目录中 - 邮件会将指标文件
metric-timestamp.html
发送到配置的收件人邮箱
配置
在指标中忽略一些不需要的库关键字
- 在
robotmetrics.py
文件中将不需要的关键字库添加到元组对象ignore_library
中 - 在指标报告中,关键字FOR, FORITEM会被忽略
- 以下是被忽略关键字的库
ignore_library = [
'BuiltIn',
'SeleniumLibrary',
'String',
'Collections',
'DateTime',
]
你可以添加新的忽略库,如RequestsLibrary, AppiumLibrary
等
总结
适当的美化测试报告信息,可以更好的表达测试信息。
如有问题,可以通过以下邮件联系。

wywincl522@gmail.com