|
eValid -- Automated Web Quality Solution
Browser-Based, Client-Side, Functional Testing & Validation,
Load & Performance Tuning, Page Timing, Website Analysis,
and Rich Internet Application Monitoring.
© Copyright 2000-2008 by Software Research, Inc.
|
|
eValid -- Synchronizing AJAX Applications
eValid Home
Summary
AJAX (Asynchronous JavaScript and XML) is
a web application implementation method that
disconnects some page updating activities from the
normal browser display in favor of having the "housekeeping" done
by a background interaction between the browser and the server,
moderated in some cases by special XML and JavaScript supplied operations.
A major difficulty in testing an AJAX application is the very
nature of the implementation: it may involve asynchronous operations.
In practice this shows up as a script "typing ahead" of the
browser, and this kind of behavior almost always leads to
loss of state information and failure of the test.
eValid has natural (automatic) and several manually augmented ways
to assure synchronized playback for AJAX applications.
Our experience is that one or more of these methods
allows a script to play back reliably
and still support full validation capabilities within the subject pages.
In many cases, the built-in "natural synchronization" is sufficient.
Synchronization Method Summary
Here is a summary of available script playback synchronization methods.
- Natural Synchronization
Synchronization is build into eValid and works
most of the time, automatically, and without additional
synchronization steps.
eValid uses a number of internal signals to determine
if it is OK to continue playback (i.e. if the playback
is fully synchronized):
- The page has reached the Interactive state
(this is a DOM internal signal).
- The page has reached the DocumentComplete
(this is a DOM internal signal).
- eValid has determined that all threaded download
activity has been completed
(this is an eValid internal method).
- eValid has determined that the rendering of the page has
reached an internal state stable enough for continuation
of automated playback
(this is an eValid internal method).
- eValid has determined,
by examination of next commanded action in the script file,
that that command has sufficient object availability
for the command to be successful
(this is an eValid internal method).
- Using SyncOnURL
This method takes advantage of the fact that you can
learn the complete set of pages that eValid downloads
when rendering a page, in the order of completion of
download, by studying the detailed eValid EventLog data.
Synchronization is obtained by having a set of
SyncOnURL commands that mention several of the pages
that are known to arrive last in a download sequence.
Here is a page that describes
Applying the SyncOnURL Command
for playback synchronization.
- Using SyncOnText
Here, eValid uses the SyncOnText command to wait for
the appearance of the required string in the internal DOM
for the page.
If the page is being populated asynchronously this
command will wait until it sees the required text, then
will continue.
You may wish to run several such commands,
or choose a phrase that is found at the bottom of the page
(because that is the part that will be completed loaded last).
Here is a description of
Testing the Google Gmail Application
that illustrates how this works.
- Using SyncOnScreenRect
This method requires use of the Windows desktop and while
it may appear to be a crude approach when it is used
correctly it is very, very reliable.
This method requires that you record a SyncOnScreenRect
command that records
a checksum of the pixel values in a particular part of a screen
which eValid records from.
At playback time eValid rechecks the value of the
current checksum,
and waits until the checksum matches before continuing playback.
Cautionary Notes
The eValid playback engine is a complex multi-threaded activity
and multiple confirmations of achieving synchronization may
be required in difficult cases.
It is easy to be deceived by some browser and/or Windows messages.
For example:
"Done" is not necessarily done;
"In focus" may not necessarily mean that a window is
actually in focus.
In addition, autonomous actions by the browser may defeat the
best natural [built in] synchronizations.
Finally, you may need to pay special attention
to a particular web applications' initial state.