assertion c# selenium code example

Example: Assertions in selenium

ASSERTIONS: 
Assertions are coming from TestNG
Assertions allows us to do our verification 
between actual and expected results
*Assert.assertEquals(actual, expected);
assertEquals :
This method expected two arguments to be passed: actual, expected. 
It compares these two values and if they are exact 
Assert.assertEquals("title", driver.getTitle()); 
*assertTrue :returning boolean values: isSelected, isDisplayed, 
isEmpty, contains, equals, startsWith etc... 
*assertFalse
Assert.fail() 
is just another static assertion method. 
Where ever you call this method, it will directly FAIL the test.

Tags:

Misc Example