HttpRunner--使用和开发拓展

1. 安装

1.1 安装

# 安装
pip install httprunner

# 查看版本
hrun -V   

1.2 相关文档

+ github:https://github.com/httprunner/httprunner
+ 官方⽂档:https://docs.httprunner.org/
+ 中文文档:https://ontheway.cool/HttpRunner3DocsForCN/
+ 2.x和3.x区别:https://www.cnblogs.com/yoyoketang/p/15009395.html

2. 创建项目

2.1 创建工程

创建脚手架
httprunner startproject HrunDemo

2.2 目录结构

tree HrunDemo -a

# 标准目录结构
├── .env
├── .gitignore
├── debugtalk.py
├── har
├── logs
├── reports
└── testcases
    ├── __init__.py
    ├── demo_testcase_ref.yml
    ├── demo_testcase_ref_test.py
    ├── demo_testcase_request.yml
    └── demo_testcase_request_test.py

3. 使用引导

  • step1: 保存或导出har文件到har目录下
  • step2 : 生成pytest标准测试文件
har2case  har/demo.har
  • step3 : hrun命令运行
hrun har/demo_test.py
  • step4: 生成测试用例
har2case  har/demo.har  -2j
har2case  har/demo.har  -2y
  • step5: 运行测试用例
hrun har/demo.json
hrun har/demo.yml

4. 开发拓展

  • 文档
https://v2.httprunner.org/

猜你喜欢

转载自blog.csdn.net/qq_25672165/article/details/120371780