Allure测试报告美化指南 – 让测试结果可视化呈现

前言

大家好,我是测试报告君。做测试报告分析4年,Allure是我最喜欢的报告框架。今天分享Allure报告的美化和定制技巧。

一、Allure报告结构

报告内容

Allure报告包含:

二、Allure注解使用

java
@Allure.Feature(“用户管理”)
@Allure.Story(“登录功能”)
@Allure.Title(“验证用户登录成功”)
@Allure.Severity(Allure.SEVERITY.CRITICAL)
public void testLoginSuccess() {
Allure.step(“打开登录页面”);
Allure.step(“输入用户名密码”);
Allure.step(“点击登录按钮”);
Allure.step(“验证登录成功”);
}

三、截图附件

java
// 失败时截图
@Attachment(value = “失败截图”, type = “image/png”)
public byte[] takeScreenshot() {
return ((TakesScreenshot)driver).getScreenshotAs(OutputType.BYTES);
}

总结

Allure报告美化要点:

要点 方法
分组 @Feature、@Story注解
步骤 Allure.step()
附件 @Attachment
严重级别 @Severity

下期预告:数据驱动测试实战 – Excel、YAML、JSON多源数据管理

分享到:

探索 RunnerGo 全栈测试平台

RunnerGo 是一款面向企业的全栈测试平台,集接口测试、自动化测试、性能测试、UI测试于一体,助力企业提升研发效能。

接口测试
性能测试
自动化测试
免费体验 RunnerGo