历史
Allure 在报告生成期间将历史信息存储到allure-report/history 文件夹。因此,在生成报告之前,您需要将之前启动的此类文件夹复制到您的allure-results。
历史功能由 Allure CI 插件开箱即用地处理
执行者信息
要添加有关您的测试执行者的信息,请在您的 allure-results 中创建一个文件 executor.json:
{
"name": "Jenkins",
"type": "jenkins",
"url": "http://example.org",
"buildOrder": 13,
"buildName": "allure-report_deploy#13",
"buildUrl": "http://example.org/build#13",
"reportUrl": "http://example.org/build#13/AllureReport",
"reportName": "Demo allure report"
}
在报告中这样的信息会这样显示:
Allure CI 插件会为你添加执行者信息
类别
您还可以在报告中添加自定义问题类别。创建文件categories.json 并将其放入您的结果文件夹中:
[
{
"name": "Ignored tests",
"messageRegex": ".*ignored.*",
"matchedStatuses": [
"skipped"
]
},
{
"name": "Infrastructure problems",
"messageRegex": ".*RuntimeException.*",
"matchedStatuses": [
"broken"
]
},
{
"name": "Outdated tests",
"messageRegex": ".*FileNotFound.*",
"matchedStatuses": [
"broken"
]
},
{
"name": "Regression",
"messageRegex": ".*\\sException:.*",
"matchedStatuses": [
"broken"
]
}
]
重试
默认情况下会处理重试。对于每个测试 Allure 都会生成historyId(通常是 md5(fullName + parameterValues))。如果报告包含相同historyId Allure 的少数结果仅显示最新,其他标记为重试,可从测试结果页面的Retries 部分获得。
例如,如果您运行测试 3 次(前 2 次损坏,最新通过,Allure 将显示此类测试通过)