Chris
Chris

Reputation: 236

Allure is not reporting failures properly with exception( nosuchelementexception )

  1. krGlobalPage.softAssertionTestCall2(softAssertion); has to run even after krGlobalPage.softAssertionTestCall1(softAssertion); is failed due to

Upvotes: 2

Views: 1595

Answers (1)

Amr El Massry
Amr El Massry

Reputation: 391

The way that I have found best - and also to show in Allure report as fail - is to try-catch the findelement and in the catch block, set the assertTrue to false, like this:

try {
    driver.findElement(By.xpath("(//nav[@class='topline']//nav[@class='without-seperator1']/a)[1]");
}catch(Exception e) {
    assertTrue(false, "Test Search link was not displayed");
}

Upvotes: 1

Related Questions