介紹
下面介紹一款Robot Framework(以下簡稱RF)測試指標(biāo)的可視化Dashboard工具robotmetrics
效果如下圖所示:

robot metrics
安裝使用
工作原理
- 使用RF的API讀取RF的輸出文件output.xml
- 使用API獲取Suite, Test Case, Keyword, Status, Start Time, End Time以及Elapsed time值
- 使用BeautifulSoup庫將數(shù)據(jù)生成html 報(bào)告
在工程中使用
- 從github倉庫中下載
robotmetrics.py文件 - 將
robotmetrics.py文件拷貝到工程項(xiàng)目中 - 安裝
beautifulsoup庫
pip install beautifulsoup4 - 執(zhí)行
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指標(biāo)報(bào)告
metric-timestamp.html會生成在指定的目錄中 - 郵件會將指標(biāo)文件
metric-timestamp.html發(fā)送到配置的收件人郵箱
配置
在指標(biāo)中忽略一些不需要的庫關(guān)鍵字
- 在
robotmetrics.py文件中將不需要的關(guān)鍵字庫添加到元組對象ignore_library中 - 在指標(biāo)報(bào)告中,關(guān)鍵字FOR, FORITEM會被忽略
- 以下是被忽略關(guān)鍵字的庫
ignore_library = [
'BuiltIn',
'SeleniumLibrary',
'String',
'Collections',
'DateTime',
]
你可以添加新的忽略庫,如RequestsLibrary, AppiumLibrary等
總結(jié)
適當(dāng)?shù)拿阑瘻y試報(bào)告信息,可以更好的表達(dá)測試信息。
如有問題,可以通過以下郵件聯(lián)系。

wywincl522@gmail.com
大家也可以加入RobotFramework社區(qū)來交流學(xué)習(xí)。

Robot Framework社區(qū)