# hrunex
**Repository Path**: cocoweb/hrunex
## Basic Information
- **Project Name**: hrunex
- **Description**: 使用 HTTPRUNNER 进行接口测试
可以兼容:YML、JSON、Excel文件格式
- **Primary Language**: Python
- **License**: MulanPSL-2.0
- **Default Branch**: master
- **Homepage**: None
- **GVP Project**: No
## Statistics
- **Stars**: 0
- **Forks**: 0
- **Created**: 2021-03-26
- **Last Updated**: 2022-04-08
## Categories & Tags
**Categories**: Uncategorized
**Tags**: None
## README
使用 HTTPRUNNER 进行接口测试
可以兼容:YML、JSON、Excel文件格式
一般流程:
1. 使用Fiddler or 浏览器 录制接口内容,导出为 Har文件
2. 使用命令行 转换Har 为指定的文件(yml/json/excel)
- har2case
- 使用har 直接转换为excel
```
python.exe hrunxls.py -i har\shouba.har -x shhshhshsh.xls
# or 默认可以输出Excel
python.exe hrunxls.py -i har\shouba.har
```
3. 执行测试
```
python.exe hrunxls.py -r testcases\shouba.xls
# 显示帮助信息
python.exe hrunxls.py -h
```
## hrunxls.py 参数说明
```
Usage: python hrunxls.py -i -x
-r
-e -l DEBUG
Options:
-h, --help show this help message and exit
-r RUNEXCEL, --runexcel=RUNEXCEL
run hrun excel testcase
-i INFILE, --infile=INFILE
input file(yml/json/har)
-x TOEXCEL, --toexcel=TOEXCEL
file(yml/json/har) to excel file
-e, --extendreport Extend Report teamplate or default template
-l LOGLEVEL, --loglevel=LOGLEVEL
loglevel DEBUG, INFO, WARNING
```
## WorkSpace 工作目录结构:
工具会自动根据testcases所在目录,创建目录结构
```
workdir
├─logs
├─reports
│ ├─
│ └─
└─testcases
```
## 转换HAR为api testcase
```
python spell.py -a demo.har # 参数必须是一个har文件,生成api/demo.yaml文件(api格式)
python spell.py -t demo.har # 参数必须是一个har文件,生成testcase/demo.json文件(json格式)
```
## 扩展 HTTPRUNNER
- config.headers 公共headers处理,执行前,将公共headers填充到testcase
- config.validate 公共validate处理,执行前,将公共validate 填充到testcase
- config.configfile configfile 配置文件,自动读取,并填入到testcase 的variables
“就近原则”,testcase中有相关内容时,优先
## 兼容 HTTPRUNNER v2.5.7
## Excel文件样例
