1.添加pytest.ini文件刀脏,如下:
[pytest]
addopts =-vs --alluredir ./output/report_json --clean-alluredir --reruns 1 --reruns-delay 2 -p no:warnings
#執(zhí)行目錄
testpaths = ./testcase
#執(zhí)行目錄下的文件
python_files = test_*.py
#執(zhí)行測試方法
python_functions = test_*
#執(zhí)行測試類
python_classes = Test*
2.運(yùn)行test文件掰盘,報錯如下:
image.png
解決方法:把pytest.ini文件中的中文全部刪除即可
pytest.ini文件,如下:
[pytest]
addopts =-vs --alluredir ./output/report_json --clean-alluredir --reruns 1 --reruns-delay 2 -p no:warnings
testpaths = ./testcase
python_files = test_*.py
python_functions = test_*
python_classes = Test*