Monday, November 2, 2009

Automated testing of web application Guidelines

Sponsored Ad

One of the key reasons for doing automated testing is to ensure that time is not dedicated to performing repetitive tasks can be completed by the tools without human intervention. The automation could be one of the most effective tools in your toolbox, but not a panacea that will solve all problems and improve quality. The automation tools are obedient servants, and as a tester you need to become his master and use them properly to realize their full potential. It is very important to understand that automation tools are as good as we use them. Conversion of test cases from manual to automatic is not the best use of automation tools. They can be used much more efficiently.

Creation of strong and useful test automation framework is a very difficult task. In the Web world, this task becomes even more difficult because things can change overnight. If we stick to calls for the automation of best practices adopted from stable, desktop applications, it is not appropriate in a web environment and will probably have a negative impact on project quality.

Many of the problems in the web world are identical. For example, regardless of any web application you always need to validate things such as the presence of ownership in all pages .Depending in context may be the presence of metadata on each page, the presence of a tracking code, the presence of ad code, size and number of ad units, and so on.

Solution presented in this article can be used to validate any or all of the rules mentioned above, through all the pages in any domain / website. They gave us a mandate to ensure that the specific tracking code is present on every page of a larger website. In an agile way, once this issue was resolved which was expanded and re-factor of incorporating many of the rules on every page.

This solution was developed using Selenium Remote Control with Python as a scripting language. One of the main reasons for using tools like Selenium RC is the ability to allow us to code in any language, and this allows us to use the power of the standard language. For this solution, a python library called Beautiful soup was used to analyze the HTML pages. This solution was ported to another tool called Serge to make it faster. Since the initial code was also developed in Python, making Twill was a piece of cake.

Essentially, this solution / script is a small web crawler, which will visit all the pages of any website and validate certain rules. As mentioned earlier, this problem statement is very simple, i.e. "validate certain rules on each website for any particular Web site. To accomplish this, the following steps were followed

1. Get Page

2. Get all links

3. Get first connecting link and if it is external and has not visited tracker, link is open.

4. Get page source

5. Validate all the rules you want to validate this page

6. Repeat steps 1 through 5 on each page.

It is worth mentioning here that the rules can be validated against this framework are the rules, which can be validated by looking at the page source code. Some of the rules that can be validated using this script are --

1. Make sure the title is present on every page and is not generic

2. Check for the Meta tags as keywords and description of each page.

3. Make sure that the instrumentation code is present on every page

4. Make sure each image has alternate text associated with it

5. Make sure the ad code that comes from the right server and have all the relevant information we need.

6. Make sure the size of the banners and skyscrapers used for the advertisement is correct.

7. Make sure all pages contain at least two ads and the page should not contain more than four ads except front page.

8. Make sure the master CSS is applied in all pages of a given domain.

9. Make sure all the styles are from the CSS files and styles are not present to any element on a webpage.

Above the list above could give an idea of what can be achieved using this approach. This list can spread very easily. You are limited only by your imagination :)

In the next article, we will see the code snippets and explain the ease with which these rules can be customized and validated through every page of a given domain.

0 comments:

Post a Comment