使用类别json文件添加自定义类别不起作用。我正在使用诱惑2.6命令行工具

时间:2018-03-05 12:47:47

标签: selenium-webdriver allure

我使用以下格式创建了一个类别json文件:

[
  {
    "name": "Iored tests", 
    "matchedStatuses": ["skipped"] 
  },
  {
    "name": "Inructure problems",
    "matchedStatuses": ["broken", "failed"]
    "messageRegex": ".*bye-bye.*", 
  },
  {
    "name": "Outed tests",
    "matchedStatuses": ["broken"]
    "traceRegex": ".*FileNotFoundException.*", 
  },
  {
    "name": "Prot defects",
    "matchedStatuses": ["failed"]
  },
  {
    "name": "Tst defects",
    "matchedStatuses": ["broken"]
  }
]

并将此文件添加到allure-results文件夹并使用allure generate命令生成报告,但生成的报告仍显示默认的产品类别。

如果我遗失了什么,请告诉我?

2 个答案:

答案 0 :(得分:0)

开始工作到这2天了。对于我来说, categories.json 工作正常 请试试。

[
  {
    "name": "Skipped tests",
    "messageRegex": ".*",
    "matchedStatuses": [ "skipped" ]
  },
    {
      "name": "Element not found",
      "traceRegex": ".*NoSuchElementError.*",
      "matchedStatuses": [ "failed" ]
    },
    {
      "name": "Broken tests",
      "traceRegex": "Error.*",
      "matchedStatuses": [ "failed"]
    },
    {
      "name": "Test defect",
      "messageRegex": ".*Expected is not a String or a RegExp.*",
      "matchedStatuses": ["failed"]
    },
    {
      "name": "Product defect",
      "traceRegex": ".*Failed expectation.*", 
      "matchedStatuses": [ "failed" ]
    },
    {
      "name": "Passed tests",
      "matchedStatuses": ["passed"]
    }
  ]

另外请看这个 https://github.com/allure-framework/allure2/issues/552

答案 1 :(得分:0)

您的 categories.json 的内容似乎不是有效的 JSON,因为尾随逗号的位置。应该是:

[
  {
    "name": "Iored tests", 
    "matchedStatuses": ["skipped"] 
  },
  {
    "name": "Inructure problems",
    "matchedStatuses": ["broken", "failed"],
    "messageRegex": ".*bye-bye.*"
  },
  {
    "name": "Outed tests",
    "matchedStatuses": ["broken"],
    "traceRegex": ".*FileNotFoundException.*"
  },
  {
    "name": "Prot defects",
    "matchedStatuses": ["failed"]
  },
  {
    "name": "Tst defects",
    "matchedStatuses": ["broken"]
  }
]