Selenium Tutorials – To test OFBiz / Opentaps Ecommerce UI

Selenium Tutorials

1) Selenium IDE is an integrated development environment for performing selenium tests. Selenium tests can be written as HTML tables or coded in various languages like C#, PHP, Perl, Python and can be run directly in most modern browsers. The IDE can help you to record, edit and debug tests.

2) Here is a possible scenario for using Selenium. Imagine you have created a HTML form with about twenty fields and you have to repeatedly test the form. Filling the form every time can quickly become tedious. With Selenium you can automate the whole process and run the test as required.

3) You can download Selenium IDE from these locations -

http://seleniumhq.org/download/

https://addons.mozilla.org/en-US/firefox/addon/2079

Once the addon is installed make sure to restart Firefox.

4) Now lets run a simple test :

a. Start Selenium IDE in Firefox: Tools->Selenium IDE.

b. Click on the red record button on the right.
c. Browse to Google.com and enter ‘selenium’ in the search box and click enter.
d. Click on the first result, which is that of selenium.openqa.org.
e. Stop the recording by clicking on the record button. You should see something like below. If you click on the ‘ Source’ tab you can see the test html generated by selenium.

The ‘table’ tab shows the commands recorded by Selenium.

f. Open a new tab in Firefox and click on the Selenium IDE’s play button to run the recorded test.

The IDE should play your recorded test. After the test is complete you should have landed on the selenium page (http://selenium.openqa.org/). The IDE after the test run is shown below. In the ‘Log section’ you can see the various events run by the test. In the table tab you can see that all the rows are green, which means that the test ran successfully.

a. Click on the blank line below after the last ‘clickAndWait’ command and insert ‘assertTextPresent’ command from the drop down box as shown below. You should see something like this.

This test checks to see if the text ‘Selenium News’ is present in the last rendered page. Run the test again and you should see that the test has run successfully. No try replacing the text with something that is not present on the page, take for example ‘elvis’ and run the test again. Now the test fails and you should get the screen below.

You have just completed your first test run. And it was so simple. ‘assertTextPresent’ is one of the hundreds of commands available for your testing needs. Just browse through the command drop down to get a feel of what you can you get.

h. The test suite in Selenium is just an HTML file that contains a table of links to tests. We can preserve this file and run it later on to see the results for particular modules like Checkout, MyAccount, CreateOrder, etc. and run it on selenium.

Share :
  • Digg
  • del.icio.us
  • Facebook
  • Mixx
  • Google
  • De.lirio.us
  • LinkedIn
  • StumbleUpon
  • Tumblr
  • TwitThis
  • E-mail this story to a friend!
  • MySpace
  • Print this article!
  • Reddit
This entry was posted in Miscellaneous, OFBiz and Opentaps and tagged , , . Bookmark the permalink.

One Response to Selenium Tutorials – To test OFBiz / Opentaps Ecommerce UI

  1. Kierra says:

    TYVM you’ve solved all my prlobems

Leave a Reply

Your email address will not be published. Required fields are marked *

*

*


You may use these HTML tags and attributes: <a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <cite> <code> <del datetime=""> <em> <i> <q cite=""> <strike> <strong>