Cost of Maintaining Automated Tests

Automated testing of web sites can be costly to mainten. Changes in layouts, element name changes, content changes, and other aspects can require significant changes to the test script. Though manual testing is labor-intensive, maintenance of test scripts requires more costly labor. How can we minimize the maintenance required as the web site changes?

Questions by wjosephson   answers by wjosephson

Showing Answers 1 - 3 of 3 Answers

This is what I have gained from my experience with Selenium, and looking at posts at other sites.  Are there similiar statements for other testing tools (WATIR, HP QTP)?

Do not use absolute document references.  Use XPath relative references. 

Use attribute values that uniquely identify the target of a script's command,
e.g. //input[@id='loginButton']

Constrain the changes that can be made to a web page through the DTD or schema

Use exception handlers in the script code to handle failures such as missing elements or timeouts and to allow the remainder of the script to progress.  Use logging to allow the failures to be assessed.

Use direct calls to web page's content servers in order to learn valid references of content on the web page. 

For example a page that displays today's major league baseball schedule varies almost daily.  If you want to verify that all games are listed properly, you can query the database server for that day's games and then search the web page for listing all the games returned by the query.

Construct the test with object oriented structure.  When a part of a  web page changes only those methods of the corresponding test object(s) need to be changed. 
See http://code.google.com/p/selenium/wiki/PageObjects  
Also see http://gojko.net/2009/10/06/putting-selenium-in-the-right-place/

  Was this answer useful?  Yes

Give your answer:

If you think the above answer is not correct, Please select a reason and add your answer below.

 

Related Answered Questions

 

Related Open Questions