HTTPRunner 3 用戶手冊 (1) 安裝部署

HttpRunner 使用 Python 開發,它支持Python 3.6+ 和大多數操作系統。
在 GitHub-Actions 上連續測試了 Python 3.6/3.7/3.8macOS/Linux/Windows 的組合。

安裝

HttpRunner 已發佈到 PyPI 倉庫,可以使用 pip 直接安裝.

$ pip3 install httprunner

如果要使用最新版本,可以使用 github 倉庫的 URL 安裝。

$ pip3 install git+https://github.com/httprunner/httprunner.git@master

如果已經安裝過,可以使用 -U 進行升級。

$ pip3 install -U httprunner
$ pip3 install -U git+https://github.com/httprunner/httprunner.git@master

檢查是否安裝成功

如果 HttpRunner 安裝成功,有 4 個命令可用:

  • httprunner: 核心命令,可以使用 HttpRunner 的所有命令
  • hrun: httprunner run 命令的別名,運行 YAML/JSON/pytest 格式的測試用例
  • hmake: httprunner make 命令的別名,將 YAML/JSON 格式的 testcases 轉換成 pytest 格式的測試用例
  • har2case: httprunner har2case 命令的別名,將 HAR 文件轉換爲 YAML/JSON 格式的測試用例

查看 HttpRunner 版本:

$ httprunner -V  # hrun -V
3.1.0

查看所有可用的命令:

$ httprunner -h
usage: httprunner [-h] [-V] {run,startproject,har2case,make} ...

One-stop solution for HTTP(S) testing.

positional arguments:
  {run,startproject,har2case,make}
                        sub-command help
    run                 Make HttpRunner testcases and run with pytest.
    startproject        Create a new project with template structure.
    har2case            Convert HAR(HTTP Archive) to YAML/JSON testcases for
                        HttpRunner.
    make                Convert YAML/JSON testcases to pytest cases.

optional arguments:
  -h, --help            show this help message and exit
  -V, --version         show version
發表評論
所有評論
還沒有人評論,想成為第一個評論的人麼? 請在上方評論欄輸入並且點擊發布.
相關文章