参数化动态生成测试报告用例的标题title
import allure
import pytest
data = [
("name1", "123456", "name1 登录成功"),
("name2", "123456", "name2 登录失败"),
("name3", "123456", "name3 登录成功")
]
@allure.story('分别传值')
@allure.title('登录测试用例-{title}')
@pytest.mark.parametrize('username,pwd,title', data)
def test_login1(username, pwd, title):
"""
登录测试用例1
"""
print(username, pwd)
if __name__ == '__main__':
pytest.main(["-s","test_py01.py"])
pytest --alluredir=./report
allure generate ./report -o ./report-html -c
allure open ./report-html
报告1.png
网友评论