I have added assertion(Assert.assertEquals(condition,"expected","message"))
, it returns true then also it gives an error and make my testcase failed, with Assertion error and message? Can any one help me if its returning true why it failed my rest of the test cases.
Below is my code:
CommonAssertion class:
public class CommonAssertion{
public static boolean verifyLocationOnViewReport(){
try{
// WebElement checkCarat=Driver.getDriver().findElement(By.xpath(PageUtility.SELECT_NEXT_LEVEL));
// checkCarat.click();
WebElement verifyCountry=Driver.getDriver().findElement(By.xpath(PageUtility.LOCATION_TEXT_VR));
String countryText=verifyCountry.getText();
System.out.println(countryText);
return true;
}
catch(Exception e){
System.out.println("not matched");
}
return false;
}}
@Test
@Test(priority = 6)
public void clickOnViewReportButton() throws Exception {
System.out.println("1");
System.out.println(CommonAssertion.verifyLocationOnViewReport());
Assert.assertEquals(CommonAssertion.verifyLocationOnViewReport(), "United States", "united states not found");
createNewReportBusiness.clickOnViewReport();