sudhir pandit
sudhir pandit

Reputation: 31

How to show broken tests under failed test category in allure report

I am trying to customize my CATEGORIES section to show broken test as failed test in allure report.

I am using the following categories JSON file:

[{
"name": "Product defects",
"traceRegex": ".*org.openqa.selenium.NoSuchElementException.*",
"matchedStatuses": ["failed"]
}]

I want all defects under Product defects category(failed tests). Can this be achieved?

Upvotes: 3

Views: 4577

Answers (3)

kiranjith
kiranjith

Reputation: 211

Catch the exception and re-throw an exception of type AssertionError. Currently Allure display test as Fail only on AssertionError and all Exception is treated as Broken

Upvotes: 0

harmider
harmider

Reputation: 431

I think you should not use category.json file to do that. This file only allows you to add new categories for filtering/sorting. It has nothing to do with statuses.

What you are trying to achieve (show broken test as failed test) is something different.

Upvotes: 1

Jeroen Lamberts
Jeroen Lamberts

Reputation: 301

this might work for you. It puts all failed testcases under the category Product defects.

[{
"name": "Product defects",
"matchedStatuses": ["failed"]
}]

You could also try to add a category ignore.

[
 {
    "name": "Product defects",
    "matchedStatuses": ["failed"]
 },
 {
    "name": "Ignored tests",
    "matchedStatuses": [ "skipped" ]
 }
]

Upvotes: 1

Related Questions