Home > Software design >  How to assert two values in selenium using Java
How to assert two values in selenium using Java

Time:12-16

I'm new to selenium and trying to assert a value which should be greater than $100 could someone help me regarding the same. Thanks in advance.

Value: $700 need to verify this value is greater than $100 (constant value)

CodePudding user response:

You can use assertTrue assertion as following:

Assert.assertTrue(actualValue > lowervalue);

CodePudding user response:

Selenium Library by default has no Assertions, you can use either TestNG's Assertions or Junit's Assertions

Test NG / Junit Assert.assertTrue Examples :

int yourActualVal = 700;
final int yourConstantVal = 100;
Assert.assertTrue(yourActualVal > yourConstantVal, "Actual Value is not greater than the constant value");

or

if(yourActualVal < yourConstantVal)
 Assert.fail("Actual Value is lesser than the constant value");
  • Related