Common Function To Compare Two Double Values in Selenium WebDriver
Common Function To Compare Two Double Values in Selenium WebDriver
//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 '"+actualDobVal+"' And Expected Value
'"+expectedDobVal+"' Do Not Match.");
Soft_Assert.fail("Actual Value '"+actualDobVal+"' And Expected Value
'"+expectedDobVal+"' Do Not Match.");
//If double values will not match, return false.
return false;
}
//If double values match, return true.
return true;
}
}
Now I can use compareDoubleVals function In my test whenever required
as described 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;