To verify or assert items on page firstly user have to record the test in selenium IDE.So lets start to create our first test on IDE.
Selenium IDE is based on record and playback.So to record the test one need to have latest firefox browser.Now a days latest version in market in 32.0.3
Click on selenium IDE from tools drop down menu or web developer drop down list or press ctrl+Alt+s which will open the selenium IDE window and record button is busy that means record mode is open.
Put Some URL in text field of BASE URL say http://www.facebook.com/ and navigate to it.
Perform some operation say put value in login and password field and the logout successfully.
Stop this recod mode.
Now our first test has been recorded and ready to playback.
Rule:-Test should always contain a open command.
Now Test has been recorded but it tested only login and password field logon page now we want to work on different items on same page .
Now the point comes to validate our test .So here comes 3 ways to validate it ie verification , assertion and waitfor.
So let me first tell you,where/why we need to do this verification/assertion/wait for.
Need for Validation
while recording our test we only focused on username,password,submit and log-out button thats it but these are not the only elements present on our web page,there are many so to verify them that whether the buttons that is mention in specification is actually present on webpage or not we do assertion or verification.
Verification v/s Assertion
See while we execute the test and the element/text which tester want to verify doesn’t get and test stops then and there ,this is assertion.Test should not move further more execution once it has been failed or does not get its expected output.Failed commands have red color which notifies user that particular command has been failed and test stopped executing and pass commands have a darker green color.For ex :-do the verification on “keep me logged in” check box on Facebook’s log on page to test whether its unchecked or not.So if verification failed then it stops.
While the test continues its execution even after fail a command to test rest of the elements of the testsuite, this is verification.Once whole commands of test been executed, but a error will be printed in the log.For ex :-do the verification on “keep me logged in” check box on Facebook log on page to test and if fails even then test will continue its execution till last.
Wait for validates the commands irrespective form of time.It paused the test until the condition provided by the tester satisfies or the time provided by the tester reached .
Some Verification and Assertion commands