java.lang.AssertionError:

29 views
Skip to first unread message

monika16jha

unread,
Jul 11, 2018, 3:57:44 AM7/11/18
to Selenium Users
HI,

I am getting below error , Please help me to resolve the issue.

java.lang.AssertionError: expected [Fields with Clear Icon] but found [Clear Icon]
at org.testng.Assert.fail(Assert.java:96)
at org.testng.Assert.failNotEquals(Assert.java:776)
at org.testng.Assert.assertEqualsImpl(Assert.java:137)
at org.testng.Assert.assertEquals(Assert.java:118)
at org.testng.Assert.assertEquals(Assert.java:453)
at org.testng.Assert.assertEquals(Assert.java:463)


Code:- 
@Test(dataProvider = "byColumnName", description = "Verify displaying clear icon", priority = 1)
  public void verifyDisplayingClearIconComponent(ControlTestData data, TestData testdata) {
    driver = getDriver();
    driver.get(url);
    objHomePage = new LoginPage(driver)
      .enterCredentials(testdata.username, testdata.password)
      .loginSuccess();
    logStep(StepStatus.PASS, "User should be able to login", "APP Login is Successful", true);
    logStep(StepStatus.PASS, "It should display Clear Icon fields on the page", "Clear Icon component is displaying all fields successfully", true);
    Assert.assertEquals(objClearIconPage.hasClearIconTitleDisplayed(), testdata.getComponentTitle());
    logStep(StepStatus.PASS, "It should display Clear Icon Title", " Title is matching as expected", true);
  }

total-qa

unread,
Jul 11, 2018, 6:32:51 AM7/11/18
to Selenium Users
Hi,

Its clear that the expected Value is not matching with the Actual value being fetched. There is an issue in your below code:

   Assert.assertEquals(objClearIconPage.hasClearIconTitleDisplayed(), testdata.getComponentTitle());

Regards,
Reply all
Reply to author
Forward
0 new messages