ABOUT US

|

SUPPORT

|

BLOGS

 

 

DEVELOPER BLOG

 

 

 

 

 

 

 

Protecting investment: Tests that do not break with page changes

 

Anthony Scotney

 

 

 

 

 

One of the critical failings of automated web application testing comes when existing (previously recorded) test cases break due to changes with web infrastructures and back-end changes. Organizations invest significant time and money in building test infrastructures and recording automated tests, to find that far too often tests break when changes are made to minor content or page structure.

Why Tests break:

Simply speaking the most frequent reason for test cases breaking in modern testing frameworks (assuming you are past the evils of First Generation test frameworks) is due to the addressing of elements within a target page. More often than not the element addressing is too granular. What we mean by “granular” is that page elements (nodes) are addressed (located) in a very page structure specific manner. Almost all testing products claim to write succinct and robust test cases but in reality nothing is further from the truth. Test cases can easily be fragile.

How LiquidTest handles page changes:

From day one, the LiquidTest development team was well aware of the “achilles heel” of Second Generation testing frameworks. Generally speaking, the LiquidTest recording element locator tries to build test cases that will not break with minor or even major page changes. The basic searching algorithm (without getting too technical) utilizes the following; unique text, ID, name, value and lastly XPath’s to locate elements. The reason the XPath is the last item we use (only if forced), is because it is the most granular and more likely to break upon page structure changes.

Example pages:

We will demonstrate how LiquidTest handles the following two page variations;

Result!

The following is the LiquidTest recorded test case, for both of the HTML page variations:

public void myTest() {
    browser.load("http://localhost/test.html");
    // Check the "Hello World" is on the page
    assertEquals("Hello World", browser.getValue("Hello World"));
}

The test case records exactly the same on both pages! This demonstrates that the test case will not break between page layout changes or changes to the page style (or content). The content addressing plays an important role in making sure test cases are robust and do not break between layout and style changes.

Does the test case replay?

Why?

It all comes down to smart robust addressing.

STOP! But what if I want page changes to be noticed? Simple answer: Just assert the structure of the document, using the DOM inspector to add assertions.

 

 

These icons link to social bookmarking sites where readers can share and discover new web pages.
  • Digg
  • del.icio.us
  • StumbleUpon
  • Reddit
  • DZone
  • TwitThis
  • email
 Comments (2)

 

 


 

 

Comments:

  1. Hello. I think the article is really interesting. I am interested in reading more. How soon will you update your blog?

    Comment by GarykPatton on June 16, 2009 at 9:37 am

  2. Gary, we plan on updating the blog regularly. Watch this space. There is much more to come!

    Comment by Anthony Scotney on June 25, 2009 at 1:18 am

Add Comment..

 

 

About this blog..

 

This is an informal place for the team at JadeLiquid to discuss software, the rotation of the earth and other things usually discussed in the JadeLiquid corridors.

 

 

 

Subscribe: By Feed  By Email

 

 

 

 

 

Categories

 

 

JadeLiquid

LiquidTest

 

 

Software Testing

 

 

WebRenderer

 

 

 

 

Recent Posts

 

 

Selenium 2 / WebDriver support coming soon to LiquidTest..
Running Selenium Tests from the Command Line
LiquidTest 3.0 with Selenium support ships!
Setting up Atlassian Bamboo to run automated Web 2.0 tests
888 installer builds and 7469 code checkins later LiquidTest 2.0 ships!

 

 

 

 

 

Popular Posts

 

 

Testing complex Ajax content
Running Selenium Tests from the Command Line
Setting up LiquidTest with Subversion and Hudson (Continuous Integration) - part 1
Creating Data-Driven Functional Tests with LiquidTest
One tool to rule them all - Reducing team division
Setting up LiquidTest with Subversion and Hudson (Continuous Integration) part 2
Is manual testing crippling your development project?
Eclipse and LiquidTest UI Introduction
Protecting investment: Tests that do not break with page changes
Testing Dynamic Elements – Having a Plan B

 

 

 

 

 

Archives

 

 

May 2011 (2) April 2011 (1) November 2010 (2) March 2010 (1) February 2010 (1) November 2009 (1) October 2009 (1) September 2009 (2) August 2009 (1) July 2009 (1) June 2009 (1) April 2009 (1) March 2009 (1)

 

 

 

 

 
   News / Events

 

 > LiquidTest EOL Announcement - Info
 > LiquidTest Release 3.0! - Available
 > Visual Studio Plugin Released! - Release
 > Cruise Control .NET Integration - Info
 > Automate your Dev/Test Process - Webinar
 > Is manual testing crippling your project? - Blog
 > Testing complex Ajax content - Blog
 
 
   Recently Added Content  
 
 > Run LiquidTest's on Selenium RC/Server - Info
 > Setting up LiquidTest with Maven - Blog
 > Officially Supported Ajax Frameworks - Info
 > Atlassian Bamboo Integration - Tech
 > Setting up LiquidTest with SVN and Hudson - Blog
 > Creating Data-Driven Functional Tests - Blog
 > Reducing Test Maintenance - Blog
 
 
  Copyright JadeLiquid Software - 2014