I have a test case as shown below . it compares 2 data and returns PASS if both data is identical .
the issue is i want this test to fail if there is data mismatch
CODE is
WebElement TxtBoxContent = driver.findElement(By.id(WebelementID));
String Content = TxtBoxContent.getAttribute("value");
String ExcelData = Generic.getXlCellValue(xlpath, sheetName, rownum, cellnum);
Content.equals(ExcelData);
Reporter.log(LocationName+" Data Verification -- PASS",true);
If you are on TestNg then to fail test case use below thow
Assert.fail();
or
Assert.fail("Write your custom error message");
Reporter.log() is for logging, it will not fail your test case.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With