1. 程式人生 > 實用技巧 >httpRunner安裝(預設翻譯官方文件,建議先看官方文件)

httpRunner安裝(預設翻譯官方文件,建議先看官方文件)

安裝

httpRunner使用的是python開發的,建議使用3.6及以上的版本,目前使用了3.6,3.7,3.9在window/Linux/macos進行了測試,均可以正常使用

httpRunner託管在PyPi上,在使用之前建議安裝好pip

使用pip命令安裝:

pip3 install httprunner

如果,受制於國內的網路,可以使用aliyun的pip映象源

如果,想使用最新的版本,可以使用GitHub上的url進行安裝:

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:主命令,用於所有函式

hrun:用於執行yaml/json/pytest測試用例

hmake:用於將yaml/json格式的測試用例轉成pytest格式的測試用例

har2case:用於將har包轉成yaml/json格式的測試用例

locusts:執行locusts用於效能測試

檢視版本:

httprunner-V# hrun -V 3.1.0

若要檢視幫助,請執行:

httprunner-h usage: httprunner [-h] [-V] {run,startproject,har2case,make} ... One-stop solutionforHTTP(S) testing. positional arguments: {run,startproject,har2case,make} sub-commandhelp run Make HttpRunner testcases
andrun with pytest. startproject Create a new project with template structure. har2case Convert HAR(HTTP Archive) to YAML/JSON testcasesfor HttpRunner. make Convert YAML/JSON testcases to pytest cases. optional arguments: -h,--helpshow thishelpmessageandexit -V,--version show version