一个完整的接口自动化测试项目到底该如何设计?httprunner框架的知识点其实并很少,前面基本上把一些重要的概念都介绍完了。 本篇就是一个总结性的,能够用于实际工做中设计一个接口自动化测试项目。html
在 HttpRunner 自动化测试项目中,主要存在以下几类文件:api
以 debugtalk.py 文件目录为项目的根目录,使用tree生成目录树框架
D:\soft\untitled\apidemo>tree /F │ .env │ debugtalk.py │ __init__.py │ ├─reports │ 1569663556.html │ ├─testcase │ test_env_demo.yml │ test_hook_demo.yml │ test_hook_demo2.yml │ test_info_demo.yml │ test_param_csv.yml │ test_param_csv_psw.yml │ user_name.csv │ user_psw.csv │ __init__.py │ └─
运行所有用例 若是我想运行整个项目的用例,能够直接运行testcase整个目录 hrun testcase
ide
hrun testcase函数
运行单个用例测试
若是我只想运行 testcase/test_env_demo.ymll的用例spa
hrun testcase/test_env_demo.ymldebug
运行多个用例设计
同时运行 testcase/test_env_demo.yml 和 testcase/test_hook_demo.yml用例code
hrun testcase/test_env_demo.yml testcase/test_hook_demo.yml
若是咱们但愿测试用例失败后中止运行,能够加--failfast参数
hrun testcase --failfast