java.lang.AssertionError

Sadakar Pochampalli
JasperSoft BI Suite Tutorials - Sadakar Pochampalli )

  • TestNG Assert.assertEquals compares the two strings 
  • This is one of situvations we get java.lang.AssertionError when the strings are not equal
  • For instance, 

String expectedEditProductURL = "http://sadakar.website.lab/Product?productId=89";
String actualEditProductURL = driver.getCurrentUrl();
Assert.assertEquals(actualEditProductURL, expectedEditProductURL);

java.lang.AssertionError: http://sadakar.website.lab/Product?productId=89 expected [http://sadakar.website.lab/Product?productId=899] but found [Change Product details hyperlink clicking is failed]
at org.testng.Assert.fail(Assert.java:97)
at org.testng.Assert.assertEqualsImpl(Assert.java:136)
at org.testng.Assert.assertEquals(Assert.java:118)
at org.testng.Assert.assertEquals(Assert.java:575)



Feedback
randomness