AJAX Testing

Posted on Jun 17 2009 - 10:02am by Raj

AJAX Testing

With the increasing popularity of Web 2.0, a large number of web applications have become more complex using advanced techniques such as Asynchronous JavaScript and XML (AJAX) which gives tremendous usability benefits. AJAX makes asynchronous calls to the web server to create more responsive web applications. Testing AJAX-based web applications is even more challenging compared to traditional web applications.

AJAX Testing Needs

• Functional Testing • Load Testing • Regression Testing

In traditional web applications, the HTML elements are already loaded in the web pages which has been fairly easy to test in an automated fashion. Unfortunately, AJAX-based web applications are not as easy or consistent to test as the traditional web applications. The problem with AJAX testing is that the web page under test will be modified asynchronously such as an element will be dynamically added based on a check box click or an element will be removed based on a list element selection, etc. To handle this dynamic element creation or removal using AJAX technique, QEngine provides some specific AJAX functions which are as follows.

• waitForDynamicElement – During playback, the test waits until the HTML Element with the given tag name and matching property name and value is identified.

• waitForDynamicElementRemoval – During playback, the test waits until the specified HTML Element with the given tag name and matching property name and value, is removed from the HTML page.

• waitForElement – During playback, the test waits until the specified HTML Element with the given Element ID is identified.

• waitForElementRemoval – During playback, the test waits until the HTML Element with the given Element ID is removed.

• waitForText – During playback, the test waits until the specified search text (with the given prefix and suffix text) appears in the HTML page that is identified in the last user action.

• waitForTitle – During playback, the test waits until the specified window title appears in the last identified HTML page.

You can insert any of the above AJAX functions in non-recording mode to handle the user actions that uses AJAX calls. These functions allow you to specify a condition such as an element to identify or text to appear and the maximum time to wait until the given condition is satisfied. Returns true and the test proceeds to the next line in the script, if the given condition is satisfied within the specified wait time. Returns false and the test proceeds to the next line in the script, if the given condition is not attainable within the specified wait time.

About the Author

Leave A Response