pytest和allure都是单元测试框架
不要点击:https://item.taobao.com/item.htm?id=613711271112
注意:配置文件不能有中文注释也不行,不然会出错,__init__.py文件不能删除,不然会报错。
def test_login1(self):
print("通过")
assert True
断言: assert True
1安装导入运行报错安装:pip3 install -u pytest (-u表示最新版)还需要安装:pip install -u allure-pytest
卸载:pip uninstall pytest
验证:pytest --version
pytest -s login.py(进入当前文件,执行指定login.py文件)
验证:
cmd执行如下命令:
pip uninstall pytest-allure-adaptor
pip install allure-pytest
成功了
设置测试程序:
2:
导入python库。
去波浪线:
改字体:
改变颜色: