'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?
Solution 1:[1]
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.
Solution 2:[2]
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" ]
}
]
Solution 3:[3]
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
Sources
This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.
Source: Stack Overflow
Solution | Source |
---|---|
Solution 1 | harmider |
Solution 2 | Jeroen Lamberts |
Solution 3 |