Pytest----生成allure执行报告

简介: Pytest----生成allure执行报告

【原文链接】

1 编写如下测试脚本

def test_1():
    print("in test_1")
    assert 1==1

def test_2():
    print("in test_2")
    assert 1==2

def test_3():
    print("in test_3")
    assert 1==1

def test_4():
    print("in test_4")
    assert 1==2

def test_5():
    print("in test_5")
    assert 1==1

def test_6():
    print("in test_4")
    assert 1==2

2 执行如下命令,制定目录生成allure日志

pytest -s --alluredir=./temp

3 执行如下命令指定生成报告的目录,根据执行结果生成allure报告

allure generate ./temp -o ./report

4 此时report目录下有index.html,即allure报告

在这里插入图片描述

4 用浏览器打开index.html,如下:

在这里插入图片描述

5 点开test_example,如下:

在这里插入图片描述

6 点击此处即可切换至中文

在这里插入图片描述

7 切换中文后,如下所示:

在这里插入图片描述

目录
相关文章
|
4天前
|
测试技术 Python
pycharm使用pytest运行测试用例,无法在控制台输出print语句、log语句的解决办法
pycharm使用pytest运行测试用例,无法在控制台输出print语句、log语句的解决办法
93 1
|
10月前
|
测试技术
22-pytest-allure.step()测试步骤描述
22-pytest-allure.step()测试步骤描述
|
10月前
|
测试技术
23-pytest-清空allure历史报告
23-pytest-清空allure历史报告
|
测试技术
pytest学习和使用14-Pytest用例执行结果有哪几种状态?
pytest学习和使用14-Pytest用例执行结果有哪几种状态?
77 0
|
测试技术 Python
pytest学习和使用10-Pytest中的测试用例如何跳过执行?
pytest学习和使用10-Pytest中的测试用例如何跳过执行?
72 0
pytest学习和使用10-Pytest中的测试用例如何跳过执行?
|
测试技术
Pytest----allure报告定制样式
Pytest----allure报告定制样式
405 0
Pytest----allure报告定制样式
|
IDE 测试技术 Linux
Pytest----如何执行pytest自动化测试脚本
Pytest----如何执行pytest自动化测试脚本
449 0
Pytest----allure报告定制logo
Pytest----allure报告定制logo
156 0
Pytest----allure报告定制logo
|
测试技术
Pytest----fixture高级应用
Pytest----fixture高级应用
136 0
|
测试技术
Pytest----默认用例发现规
Pytest----默认用例发现规
129 0