httprunner(11)執行測試報告
阿新 • • 發佈:2021-02-10
# 前言
受益於pytest的整合,HttpRunner v3.x可以使用pytest所有外掛,包括`pytest-html`和`allure-pytest`,也可以實現這2種方式的報告
# 內建html報告
`pytest-html`外掛隨HttpRunner一期安裝。當你執行測試用例想生成html報告時,可以在命令列中新增`--html`
安裝Httprunner時,`pytest-html`外掛也會隨之安裝,當執行測試用例的時候,想生成html形式的報告,可以在命令列中新增`--html + 報告路徑`
```
$ hrun /path/to/testcase --html=report.html
```
舉例:在當前目錄執行testcases下的所有用例,並在當前目錄下的report目錄下,生成名為`test_report.html`的報告
```
(httprunner_env) ➜ hrun_demo hrun testcases --html=reports/test_report.html
2021-02-10 11:24:21.055 | INFO | httprunner.make:__make:512 - make path: /Users/jkc/hrun/hrun_demo/testcases
2021-02-10 11:24:21.057 | INFO | httprunner.make:format_pytest_with_black:170 - format pytest cases with black ...
No Path provided. Nothing to do