Tanuj Vishnoi
Tanuj Vishnoi

Reputation: 329

Add custom category using categories json file is not working . I am using allure 2.6 command line tool

I created a categories json file with the following format:

[
  {
    "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"]
  }
]

and added this file to the allure-results folder and generate the report using allure generate command, but still, the generated reports show the default product categories.

Please let me know if I am missing anything?

Upvotes: 2

Views: 5697

Answers (2)

Serhii Hrynko
Serhii Hrynko

Reputation: 132

It looks like content of your categories.json is not a valid JSON, because of trailing commas placement. Should be:

[
  {
    "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"]
  }
]

Upvotes: 1

user2176592
user2176592

Reputation: 159

Started working in to this 2 days back. For me below categories.json works fine Please try.

[
  {
    "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"]
    }
  ]

Also please see this https://github.com/allure-framework/allure2/issues/552

Upvotes: 1

Related Questions