安装
HttpRunner使用python开发,支持Python 3.6+和大多数操作系统。 在Python 3.6/3.7/3.8上 和 MacOS/Linux/Windows上,基于GitHub-Actions 上进行了测试。
安装
HttpRunner存储于PyPI, 支持通过pip安装。
pip3 install httprunner
如果你想保持最新版本,可用github资源地址安装。
pip3 install git+https://github.com/httprunner/httprunner.git@master
如果你之前已安装过HttpRunner,想更新到最新版本,可以使用-U选项。
pip3 install -U httprunner
pip3 install -U git+https://github.com/httprunner/httprunner.git@master
安装检查
安装HttpRunner后,以下5个命令会写入系统环境变量配置。
* httprunner
:主命令,用于所有功能。
* hrun
:指令httprunner run
的别名,用于运行YAML/JSON/Pytest 测试用例。
* hmake
: 指令httprunner make
的别名,将YAML/JSON用例转换成pytest用例。
* har2case
:指令httprunner har2case
的别名,将HAR文件转换成 YAML/JSON 用例。
* locust
: 利用locust 运行性能测试。
查看httprunner
版本:
$ httprunner -V # hrun -V
3.1.0
查看可以使用的功能选项,运行:
$ httprunner -h
usage: httprunner [-h] [-V] {run,startproject,har2case,make} ...
一种HTTP(S)测试的解决方案。
选项说明:
{run,startproject,har2case,make}
子命令说明
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
注意:
locust
是一个单独的命令,locust
运行开始阶段时,monkey patch ssl避免递归错误