使用pytest框架进行allure基础测试报告的生成操作(一)
发布时间
阅读量:
阅读量
一、写一个简单的基于pytest的测试用例test_allure.py:
import os
import pytest
# pytest的测试用例文件必须是 test_开头或者_test结尾命名
# pytest的测试用例类必须是Test开头
class Testallure:
def test_1(self):
# 测试用例内部的注释会作为该测试用例的描述展示在报告中
"""test_1是第一个测试用例"""
print('这是test_1')
def test_2(self):
# 测试用例内部的注释会作为该测试用例的描述展示在报告中
"""test_2是第二个测试用例"""
print('这是test_2')
if __name__ == '__main__':
"""
(1)不写 -s 就会将测试用例中的print内容打印至index.html中,就不会打印至控制台
(2)test_allure.py是要执行的.py文件名
(3)--alluredir 是创建json结果保存路径,后面./result就是自定义的文件夹名称
(4)多次执行
全部评论 (0)
还没有任何评论哟~
