What Is The Difference Between Assert And Verify In Selenium

0
43
Spread the love
  • 1
  •  
  •  
  •  
  •  
  •  
  •  
  •  
  •  
  •  
    1
    Share

Difference Between Assert And Verify In Selenium
Difference Between Assert And Verify In Selenium

Difference Between Assert And Verify In Selenium:

Here is a small effort to understand the difference between to technologies of selenium called..

  • Assert*
  • Verify* 





Assert Verify
Assert* will fail the test if something is missing and execution will stop there Verify* will report the missing item at last without stopping the execution
One can easily understand what went wrong during execution One has to go through result files or log to understand why it got failed
Live visual display of error Test engineer has to follow the script or result file to create such environment
Mostly used in debug mode,This can be used in releases or in production to make sure everything is ok and will not affect other user Mostly used in test automation execution during release,UAT
Test coverage becomes lesser Test coverage is higher
When an assert fails the test is immediately aborted when a verify fails the test will continue till end

Example of Asset Statement:

                        try 
                        { 
                                Assert.IsFalse(selenium.IsTextPresent("Ask QTP")); 
                        } 
                        catch (AssertionException e) 
                        { 
                                verificationErrors.Append(e.Message); 
                        } 


Example of Verify Statement:

verifyEquals(selenium.getText("arg1"), "arg2"); 

Hope you like this post . Please let me know about thought on this. Please post your comment below.

Don't miss out!
Subscribe To Newsletter

Receive top technical news, lesson ideas, travel tips and more!

Invalid email address
Give it a try. You can unsubscribe at any time.

Spread the love
  • 1
  •  
  •  
  •  
  •  
  •  
  •  
  •  
  •  
  •  
    1
    Share

LEAVE A REPLY

Please enter your comment!
Please enter your name here