魅力报告不显示类别[codeceptjs]

时间:2018-12-03 17:34:07

标签: report allure codeceptjs

我正在尝试使用category.json文件将失败的测试结果分类为各种类别。我正在使用以下JSON文件:

[
    {
      "name": "Ignored tests", 
      "matchedStatuses": ["skipped"]
    },
    {
      "name": "Infrastructure problems",
      "matchedStatuses": ["broken", "failed"],
      "messageRegex": ".*An unknown server-side error occurred.*"
    },
    {
      "name": "Outdated tests",
      "matchedStatuses": ["broken"],
      "traceRegex": ".*FileNotFoundException.*"
    },
    {
      "name": "Test defects",
      "matchedStatuses":[
          "broken",
          "Element is not currently visible and may not be manipulated"
        ],
      "traceRegex":[
          ".*Cannot read property.*",
          ".*is not in DOM or there is no element.*",
          ".*is not a function.*"
        ]
    },
    {
      "name": "Element Not visible",
      "traceRegex":[
          ".*still not visible after.*",
          ".*Element is not currently visible and may not be manipulated.*",
          ".*was not found by text|CSS|XPath.*"
        ]
    },
    {
      "name":"Promise Rejected",
      "traceRegex": [".*Promise was rejected with the following reason.*"]
    }
  ]

并在诱人报告中,仅获得产品缺陷。

This is how it looks

我正在使用 诱惑力:2.8.1 的codeceptjs:1.4.6 鸦片:1.8.2

2 个答案:

答案 0 :(得分:0)

您的categories.json文件格式错误(traceRegex应该是字符串)。如果您希望每个类别具有多个匹配项,只需使用相同的名称:

[{
  "name": "Element Not visible",
  "traceRegex": ".*still not visible after.*"
}, {
  "name": "Element Not visible",
  "traceRegex": ".*Element is not currently visible and may not be manipulated.*"
}]

答案 1 :(得分:0)

除了 Dmitry Baev's answer 之外,您还可以随时使用“|” - Regex Alternation Operator (| or |)

在您的情况下,它将如下所示:

{
  "name": "Element Not visible",
  "traceRegex": "(.*still not visible after.*)|(.*Element is not currently visible and may not be manipulated.*)|(.*was not found by text|CSS|XPath.*)"
}

可以进一步简化为:

{
  "name": "Element Not visible",
  "traceRegex": ".*(still not visible after)|(Element is not currently visible and may not be manipulated)|(was not found by text|CSS|XPath).*"
}