【问题标题】:How does allure get the test status in categories.jsonallure如何获取categories.json中的测试状态
【发布时间】:2018-08-10 13:27:03
【问题描述】:

执行测试后,我在allure-results 目录中获取 XML 文件。从那里我使用以下命令生成 HTML 报告:

allure generate allure-results --clean -o allure-report

allure-results 中,我有一个categories.json 文件,用于根据结果(例如:通过、损坏、失败...)对HTML 报告中的测试进行分类。我相信这个分类是靠魅力来做的。

所以我想知道这个分类的魅力是什么。

categories.json

{
  "name": "Ignored tests",
  "messageRegex": ".*ignored.*",
  "matchedStatuses": [ "skipped" ],
  "flaky": true
},
{
  "name": "Infrastructure problems",
  "traceRegex": ".*RuntimeException.*",
  "matchedStatuses": [ "broken", "failed" ]
},
{
  "name": "Outdated tests",
  "messageRegex": ".*FileNotFound.*",
  "matchedStatuses": [ "broken" ]
},
{
  "name": "Passed",
  "messageRegex": ".*",
  "matchedStatuses": [ "passed" ]
}

样本测试报告图片:

【问题讨论】:

  • 我不清楚问题是什么。你能详细说明一下吗?
  • @Bunnynut 我已经提供了更多细节。
  • 基于matchedStatusesmessageRegex 匹配的测试?

标签: report allure


【解决方案1】:

categories.json 应该是一个映射列表。

在你的情况下它应该看起来像

[
  {
    "name": "Ignored tests",
    "messageRegex": ".*ignored.*",
    "matchedStatuses": ["skipped"],
    "flaky": true
  },
  {
    "name": "Infrastructure problems",
    "traceRegex": ".*RuntimeException.*",
    "matchedStatuses": ["broken", "failed"]
  },
  {
    "name": "Outdated tests",
    "messageRegex": ".*FileNotFound.*",
    "matchedStatuses": ["broken"]
  },
  {
    "name": "Passed",
    "messageRegex": ".*",
    "matchedStatuses": ["passed"]
  }
]

【讨论】:

    猜你喜欢
    • 2015-06-07
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 2023-03-15
    • 2016-07-07
    • 2017-03-15
    • 1970-01-01
    • 1970-01-01
    相关资源
    最近更新 更多