項目介紹
- 接口功能測試應用:http://www.weather.com.cn/data/cityinfo/<city_code>.html
- 測試功能:獲取對應城市的天氣預報
- 源碼:Python
- 功能包: HttpClient
- 請求方法:Get
- 自動化測試框架:pytest
- 源碼位置:https://github.com/shifengboy/iInterface_python
源碼講解
- HttpClient:網絡http請求類
- Weather:測試用例類
- Readme.md: 說明
項目配置
1.新建一個自由風格的項目
2.添加項目描述和運行節點
3.添加git源碼
4.構建項目命令
構建命令
. ~/.bash_profile
# 進入到項目目錄
cd iInterface_python
# 安裝項目所需依賴
pip3 install -r requirements.txt
# 運行項目並生成allure報告
pytest -vs test/weather_test.py --alluredir=./allure-results --clean-alluredir
# 打開報告
allure generate ./allure-results -o ./allure-reports --clean
# 刪除已存在的報告包
rm -rf allure-reports.zip
# 生成新報告包,用於發送郵件
zip -r allure-reports.zip allure-reports
allure的安裝及使用參見:https://www.cnblogs.com/feng0815/p/13792188.html
5.添加allure報告路徑
6.添加郵件配置
保存,構建
生成的allure報告