Compare Two Integer Values in Selenium WebDriver Test
Compare Two Integer Values in Selenium WebDriver Test
//This will throw soft assertion to keep continue your execution even
assertion failure.
//Un-comment bellow given hard assertion line and commnet soft
assertion line If you wants to stop test execution on assertion failure.
//Assert.fail("Actual Value '"+actualIntegerVal+"' And Expected Value
'"+expectedIntegerVal+"' Do Not Match.");
Soft_Assert.fail("Actual Value '"+actualIntegerVal+"' And Expected Value
'"+expectedIntegerVal+"' Do Not Match.");
//If Integer values will not match, return false.
return false;
}
//If Integer values match, return true.
return true;
}
}
Now you can call compareIntegerVals() function In your test to compare two
Integer values as shown In bellow given example.
package Testng_Pack;
import
import
import
import
import
import
org.openqa.selenium.By;
org.openqa.selenium.WebDriver;
org.openqa.selenium.firefox.FirefoxDriver;
org.testng.annotations.AfterTest;
org.testng.annotations.BeforeTest;
org.testng.annotations.Test;