allure的2.23.1版本word标题样式怎么设置错乱?

allure官方文档http://allure.qatools.ru/
一、allure定制化标签示例1:演示了基本allure定制化标签的使用方法1、test_allure_example_001.py
# 见图-001、002
@allure.epic('淘宝')
# 工程级别
@allure.feature('设置')
# 模块级别,一级标签
@allure.story('账户安全')
# 模块级别,二级标签
@allure.title('用例标题:test_001')
# 三级标签
test_allure_example_001.py内容:
import pytest
import os
import allure
@allure.epic('淘宝')
# 工程级别
@allure.feature('设置')
# 模块级别,一级标签
class Test10:
@pytest.mark.parametrize('result,real_result', [[3**3, 27], [2**25, 33554432], [5, 5]])
# 参数化
@allure.story('账户安全')
# 模块级别,二级标签
@allure.title('用例标题:test_001')
# 三级标签
def test_001(self, result, real_result):
assert result == real_result
@allure.story('通知提醒')
# 模块级别,二级标签
@allure.title('用例标题:test_002')
# 三级标签
def test_002(self):
assert 1 == 1
@allure.story('隐私设置')
# 模块级别,二级标签
@allure.title('用例标题:test_003')
# 三级标签
def test_003(self):
assert 1 == 1
@allure.story('主题显示')
# 模块级别,二级标签
@allure.title('用例标题:test_004')
# 三级标签
def test_004(self):
assert 1 == 1
if __name__ == '__main__':
pytest.main(['test_allure_example_001.py', '-s', '--alluredir', '../report/tmp'])
os.system('allure generate ../report/tmp -o ../report/report --clean')
# os.system('allure serve ../report/tmp -o ../report/report --clean')
图-001图-002示例2:演示了所有allure定制化标签的使用方法test_allure_example_002.py # 见图-003
演示了所有allure定制化标签的使用方法。
@allure.epic()
# 项目描述,敏捷里面的概念,定义史诗,往下是feature
@allure.feature()
# 模块名称,功能点的描述,往下是story
@allure.tag()
# 用例标记,自定义内容
@allure.story()
# 用户故事,用户故事(需求点),往下是title
@allure.title()
# 用例标题,重命名html报告名称
@allure.testcase()
# 用例链接,对应功能测试用例系统里面的case
@allure.issue()
# 缺陷连接,对应缺陷管理系统里面的链接
@allure.description()
# 用例描述,测试用例的描述
@allure.step()
# 操作步骤,(于将一个测试用例,分成几个步骤在报告中输出)
@allure.severity()
# 用例等级,blocker,critical,normal,minor,trivial
@allure.link()
# 定义链接,定义一个链接,在测试报告展现
@allure.attach()
# 添加附件,通常是一些测试数据信息
@allure.attach.file()
# 添加附件,通常是一些测试数据信息
test_allure_example_002.py内容:
import pytest
import os
import allure
@pytest.fixture(scope="session")
def login():
print("前置条件:登录")
@allure.step("步骤1")
def step_1():
print("操作步骤----1")
@allure.step("步骤2")
def step_2():
print("操作步骤----2")
@allure.step("步骤3")
def step_3():
print("操作步骤----3")
@allure.epic("测试项目:APP")
@allure.feature("1级标签_测试模块:1")
@allure.tag("核心关注")
@allure.testcase("http://www.testcase.com")
@allure.issue("https://www.bug.com/")
@allure.link("https://www.link.com/")
class TestC1():
@allure.title("测试用例的标题:test_1")
@allure.story("2级标签_测试模块:1")
@allure.severity("blocker")
# 用例等级
@allure.description("我是用例test_1的描述内容-description")
# 用例描述,优先级大于在用例下的注解:''我是用例test_1.1的描述内容-description'''
def test_1(self, login):
'''我是用例test_1.1的描述内容-description'''
print("测试用例1")
step_1()
step_2()
@allure.description("我是用例test_2的描述内容-description")
# 用例描述
@allure.story("2级标签_测试模块:2")
def test_2(self, login):
print("测试用例2")
step_1()
step_3()
@allure.epic("测试项目:APP")
@allure.feature("1级标签_测试模块:2")
@allure.tag("重点关注")
@allure.testcase("http://www.testcase.com")
@allure.issue("https://www.bug.com/")
@allure.severity("critical")
# 用例等级
class TestC2():
@allure.story("2级标签_测试模块:3")
@allure.description("我是用例test_3的描述内容-description")
# 用例描述
def test_3(self, login):
print("测试用例3")
step_1()
@allure.tag("一般关注")
@allure.story("2级标签_测试模块:4")
@allure.description("我是用例test_4的描述内容-description")
# 用例描述
def test_4(self, login):
print("测试用例4")
step_3()
if __name__ == '__main__':
pytest.main(['test_allure_example_002.py', '-s', '--alluredir', '../report/tmp'])
os.system('allure generate ../report/tmp -o ../report/report --clean')
# os.system('allure serve ../report/tmp -o ../report/report --clean')
图-003示例3:在报告里添加附件test_allure_example_003.py # 见图-004
allure.attach.file()
# 添加附件,在报告里添加附件
test_allure_example_003.py内容:
import pytest
import os
import allure
@allure.epic("测试项目:APP")
@allure.feature("1级标签_测试模块:1")
class TestAllure():
@allure.story("2级标签_测试模块:1")
@allure.title("用例标题-1")
@allure.story("2级标签_测试模块:2")
@allure.title("用例标题-2")
def test_1(self):
allure.attach.file(r'.\test_001.png', '我是附件截图的名字', attachment_type=allure.attachment_type.JPG)
if __name__ == '__main__':
pytest.main(['test_allure_example_003.py', '-s', '--alluredir', '../report/tmp'])
os.system('allure generate ../report/tmp -o ../report/report --clean')
# os.system('allure serve ../report/tmp -o ../report/report --clean')
图-004示例4:设置用例级别 @allure.severity()用例等级,按严重级别来标记,blocker,critical,normal,minor,trivial
pytest -case --alluredir=../report/tmp --allure-severities=normal,critical
BLOCKER = 'blocker' 阻塞缺陷
CRITICAL = 'critical' 严重缺陷
NORMAL = 'normal' 一般缺陷
MINOR = 'minor' 次要缺陷
TRIVIAL = 'trivial' 轻微缺陷
# 代码示例:
import pytest
import allure
@allure.severity("normal")
def test_case_1():
print("test case 1")
@allure.severity("critical")
def test_case_2():
print("test case 2")
@allure.severity("critical")
def test_case_3():
print("test case 3")
@allure.severity("blocker")
def test_case_4():
print("test case 4")
def test_case_5():
print("test case 5")

我要回帖

更多关于 word标题样式怎么设置 的文章

 

随机推荐