Assert Equal

Assert Equal checks if the expected value is equal to the actual value.

AssertEqual will log failures to the playback logs if the expected and actual values are not equal. It logs the step when the assertion passes in the logs section.

Do not use this in an if condition as it does not return any value, and throws an exception if the assertion fails.

The example below and Usage:

In the above example: 'var1' is holding the value using a 'getText' API to store the value of a heading on the page, and assert equal in step 8 is checking for the assert equal with an expected string from the value column.

Below has example of Assert Equal, Assert Exists, Assert False, Assert Not Equal, Assert Does not Exists, Assert Not Null, Assert Null:

Javascript example

Copy
navigateTo("http://sahitest.com/demo/training/login.htm  ");
assertExists(bold("Sahi Training Site"));
        
assertNull(null);
        
assertNotExists(bold("abc"));
        
assertContainsText("Sahi",bold("Sahi Training Site"));
        
var val1=_getText(_bold("Sahi Training Site"));
        
assertDoesNotContainText(log(val1);
        
assertEqual(val1,"Sahi Training Site");
        
assertNotEqual(val1,"abc");
        
assertFalse("abc");
        
var val2=_isVisible(_bold("Sahi Training Site"));
        
assertTrue(val2);
        
assertNotNull("Sahi Training Site");