
Record testcases with Selenium IDE

- Install the firefox plugin, note the latest version work only in Firefox 2.0 not in 3.0Beta!
- Install also XPather another Firefox extension, very helpful to get the elements XAPTH in pages.
- Of course restart Firefox
- Open either the sidebar (go to menu View, Sidebar, Selenium IDE) or the floating windows
(go to menu Tools – Selenium IDE) - Go to the page where you wan to test something
- Put the right Base URL (A) and press button (B) when ready
- You can now act like any user, enter data, change values, click on links
- When You wan to add a check, you can at any time right click on a HTML element
(a text, a cell, a button…) to see what selenium is proposing you. - Not all possibility are proposed…so this is where knowing the element XPATH is helping…
for more complex check, you can right click on any element and get the XPATH
now just cut and paste and feed the command (I choose verifytextPresent) - Don’t forget to stop the engine when you are finished or the script may be huge.
- Into C, You can now cut and paste one or many lines, insert new commands (add more assert)
- And replay
till the bar is green
Attention:
- Do not abuse XPATH expression as it somehow hard code the previous position of the element in the page.
- Try to make each test run on its own, do not expect that the test before is successful (so login. test functionality 1, logout)
- Keep unit test small,
- Keep all test in a repository (CVS or SVN) or many backup.
Read also: