Wednesday, March 24, 2010

Selenium test suite for Suteki Shop

I have finally got around to checking out Selenium. Selenium, if you don’t know, is an open source browser automation package that you can use to create automated tests for your web application. It’s most basic form is a Firefox plug-in, Selenium IDE, that is incredibly easy to use. You simply click around your application and it records what you are doing. You can then play back those actions as test cases. I went from knowing nothing about Selenium to having a working set of test cases in a couple of hours, and most of that time was spent recording the tests. I only had to do a little googling to work out how to deal with the TinyMCE WYSIWYG editor we use for the product descriptions.

I’ve recorded some basic test cases for Suteki Shop (my little open source eCommerce application). To try them out, do the following:

1. Download and install Selenium IDE from here.

2. Get the latest Suteki Shop source code from the Google Code repository here.

3. Create the SutekiShop SQL Server database in localhost\SQLEXRESS by running in the numbered database creation scripts in <your source location>\sutekishop\Database

4. Open the SutekiShop solution in Visual Studio. Make sure that the Suteki.Shop project is set as the start-up project and hit ctrl-F5 to run it. You should see suteki shop in your browser. Make sure it’s the active window in Firefox (not IE!).

5. Open Selenium IDE by clicking on Tools –> Selenium IDE in Firefox.

6. In the Selenium IDE choose File –> Open Test Suite and select <your source location>\sutekishop\Selenium_test_scripts\SutekiShop_test_suite.html

Note: You will have to change the location of the image files in the Product_Edit_Surprise_Add_Images and the Product_Edit_Victory_Add_Images test cases. Change the images paths to start from your source location, so for example change:
E:\\Source\\sutekishop\\Selenium_test_scripts\\Images\\surprise1.jpg
to
<Your source location>\\sutekishop\\Selenium_test_scripts\\Images\\surprise1.jpg

If anyone can tell me how to use a relative path from the selenium test case here I would be much obliged.

7. Click the ‘Play Entire Test Suite’ icon in Selenium IDE. You’ll see Selenium automatically run the application through some basic tests.

SeleniumTests 
If you write web applications of any kind you should check out Selenium. I’ve still to explore the advanced features, but for quickly putting together simple regression tests it’s very nice.

1 comment:

  1. Respected sir,
    I know how to use casle windor with
    asp.net mvc.But i dont know advanced topics like open generics with windsor.Could you help me with advanced topics in windsor.I dont
    mind paying to you for the program
    and training for a good decent price.Pls reach me at vsanthnidhi@gmail.com and vsanth@gmail.com


    with regard
    d.vasanth

    ReplyDelete

Note: only a member of this blog may post a comment.