Friday, January 26th, 2007

SJAX: AJAX option for automated in-browser testing

Category: Testing

<p>Vitaliy Shevchuk has proposed SJAX: AJAX option for automated in-browser testing which makes testing of Ajax apps simpler with Selenium that having to waitForAjax and friends.

The Problem

However, things are getting more complicated with AJAX. No page is loaded, but the content has changed. And it hasn’t changed instantly; AJAX is asynchronous by its definition. Setting a bug interval is a bad solution: it makes build cycle very slow without really solving the problem.

Some guys suggest using a “waitForCondition” command. In other word, every time AJAX is in action you need to manually add a waiting condition. This is much better then nothing; at least it is a real working solution. However, test creating is much longer and less fun.

Another option would be to extend Selenium to make it aware the underlying AJAX framework, so that the test case would pause until XMLHttpRequest is satisfied. Well, it requires extending Selenium, which is not very simple task neither. And there is a multitude of AJAX frameworks available, it would be impossible to adapt Selenium to every of them. And there are other in-browser testing solutions, not only selenium: both open source and commercial ones.

Solutions?

And the ideal scenario would be the following:

  • Test, application itself or the in-browser testing framework raises a flag to mark the current session as the one of automated testing.
  • AJAX framework detects the flag and passes to synchronous mode.
  • In this case, a method of user action simulation (click/type) of Selenium will not return until the AJAX data is successful fetched and processed. So Selenium will not be able to continue before the page content is updated, and it’s exactly what the user expects from his macros.

Related Content:

Posted by Dion Almaer at 10:18 am
7 Comments

+++--
3.5 rating from 23 votes

7 Comments »

Comments feed TrackBack URI

I like this for .NET :) http://artoftestinc.blogspot.com/2007/01/ajax-testing-and-waiting-for-page.html

Comment by John Smic — January 26, 2007

Any Unit testing method for ASP.NET? I really interested on finding it out.

Comment by PohEe.com — January 27, 2007

anyone try iMacros?

https://addons.mozilla.org/firefox/3863/

I haven’t tried it yet.. I just stumbled across it, and thought of this post.

Comment by Abraham Elias — January 29, 2007

Looks like iMacros has pretty bad ratings. I’m using WebAii works on both FireFox and IE and can be used to automate ASP.NET applications.

Comment by Tom — February 20, 2007

InCisif.net is an automation tool designed to implement client-side functional
testing of web applications under Internet Explorer 6.x or 7.x, using the C#
or VB.NET language with Visual Studio 2003, 2005 or express editions.

– Record mode with interactive DOM viewer
– XML report and test execution trace file.
– XML Test/suite reporting api.
– Specific methods to support AJAX applications
– NUnit support (source code available)
– TestDriven.net add-in support (source code available)
– IronPython support

Comment by Frederic Torres — March 18, 2007

Synchronizing playback for site that deliver information
asynchronously has long been an issue in automated web
testing, and the eValid solution has addressed this in a
number of ways:

* There is built-in page synchronization that is much
stronger than the “on page complete” logic — which
experienced users will recognize as sometimes unreliable.

Instead, eValid uses a combination of six different
internal events to assure the next command does not issue
until the current page is fully loaded.

* eValid has a special DOM-sync command that can be used to
wait for appearance of a specific text item in any part of
the page (including in a late-arriving iframe).

* More recently, eValid has been extended to include a
“SyncOnSelectedObjectProperty” command that allows a user
to specify an object property to use for synchronization
(e.g. when that property has the value “READY”).

Here is the manual page for this powerful command:

http://www.e-Valid.com/Products/Documentation.7/Testing/sync.on.dom.html

We encourage AJAX programmers to use the powerful
synchronization modes to achieve fully automated “hands off”
testing of AJAX application.

You can download your evaluation copy of eValid V7 from:

http://www.e-Valid.com/Products/Download.7/down.evalid.7.phtml?status=FORM

Full details about the eValid web analysis and testing suite
can be found at:

http://www.e-Valid.com

Comment by Edward Miller — April 16, 2007

Have a look at Sahi (http://sahi.co.in) . It hooks into the XMLHttpRequest object and does not require waits. Sites built on ext-js and dojo have been successfully tested. It also has a very powerful element identifier which helps in identifying elements which do not have ids or have ids which are dynamically generated.

Comment by Narayan Raman — November 28, 2007

Leave a comment

You must be logged in to post a comment.