krGlobalPage.softAssertionTestCall2(softAssertion);
должен работать даже после сбоя krGlobalPage.softAssertionTestCall1(softAssertion);
из-за
nosuchelementexception
Испытание должно быть провалено с КРАСНЫМ цветным индикатором в отчете Allure.
@Test(description = "softAssert")
public void softAssert(Method method) {
SoftAssert softAssertion = new SoftAssert();
KrGlobalPage krGlobalPage = new KrGlobalPage(prop, driver, wait);
krGlobalPage.softAssertionTestCall1(softAssertion);
krGlobalPage.softAssertionTestCall2(softAssertion);
softAssertion.assertAll();
}
assertions.assertEquals("msg1", "msg2", "msg1&msg2 not equal");
- работает нормально и правильно сообщает об ошибках.
@Test(description = "softAssert")
public void softAssert(Method method) {
SoftAssert softAssertion = new SoftAssert();
KrGlobalPage krGlobalPage = new KrGlobalPage(prop, driver, wait);
krGlobalPage.softAssertionTestCall1(softAssertion);
krGlobalPage.softAssertionTestCall2(softAssertion);
softAssertion.assertAll();
}
@Step("SoftAssertion test1")
public void softAssertionTestCall1(SoftAssert assertions) {
Allure.step("softAssert Method Was Started", Status.SKIPPED);
assertions.assertTrue(false);
}
@Step("SoftAssertion test2")
public void softAssertionTestCall2(SoftAssert assertions) {
Allure.step("softAssert Method Was Started", Status.SKIPPED);
}
См. НижеСкриншот.
Но когда nosuchelementexception на assertions.assertEquals((driver.findElement(By.xpath("(//nav[@class='topline']//nav[@class='without-seperator1']/a)[1]").getAttribute("href")), "www.cort.com");
, krGlobalPage.softAssertionTestCall2(softAssertion)
не выполняется.Пожалуйста, смотрите скриншот.
Как запустить krGlobalPage.softAssertionTestCall2(softAssertion);
даже после сбоя krGlobalPage.softAssertionTestCall1(softAssertion);
из-за nosuchelementexception
и неудачного теста с красным цветным индикатором, как показано на первом скриншоте?
Почему assertions.assertTrue(false);
работает как положено?
Почему assertions.assertEquals((driver.findElement(By.xpath("(//nav[@class='topline']//nav[@class='without-seperator1']/a)[1]").getAttribute("href")), "www.cort.com")
не работает должным образом?
@Test(description = "softAssert")
public void softAssert(Method method) {
SoftAssert softAssertion = new SoftAssert();
KrGlobalPage krGlobalPage = new KrGlobalPage(prop, driver, wait);
krGlobalPage.softAssertionTestCall1(softAssertion);
krGlobalPage.softAssertionTestCall2(softAssertion);
softAssertion.assertAll();
}
@Step("SoftAssertion test1")
public void softAssertionTestCall1(SoftAssert assertions) {
Allure.step("softAssert Method Was Started", Status.SKIPPED);
assertions.assertEquals((driver.findElement(By.xpath("(//nav[@class='topline']//nav[@class='without-seperator1']/a)[1]").getAttribute("href")), "www.cort.com");
}
@Step("SoftAssertion test2")
public void softAssertionTestCall2(SoftAssert assertions) {
Allure.step("softAssert Method Was Started", Status.SKIPPED);
}
