Monday, August 8, 2011

What is the best way to record a test that you know will run when you play it back?

An eValid user wrote:
What is the best way to record a test that you know will run when you play it back?

The answer depends on what kind of web application you are testing.

(1) If you are driving a "conventional" (non-AJAX, see below) website, then eValid orginarily has sufficient internal automatic playback synchronizations built in so that you don't need any extra steps. Just type and click and eValid will record what you've done and will play it back, no problem.

Standard advisory note: If you record logging in to an application and then play back that script withOUT having logged out, then it's likely the playback will fail. You're still logged in! Of course it will fail. Good practice says, either record after having logged in and don't log out, or record the login and make sure you end with a logout.

(2) For AJAX applications the situation is more difficult. Because of AJAX activity in the browser, you may not get an accurate playback because the time that AJAX takes varies with web load and other factors. The "out of the box" recording with no special steps may or may not fully synchronize at playback time.

However, there is a very simple recording protocol that we recommend to use when you are dealing with an AJAX application. The basic idea is to use the eValid: Record > Validate > & Synchronize > Text String sequence from the eValid GUI to create synchronization logic as you make the recording. The sequence is simple: Act, Wait, Sync, [Act, Wait, Sync]...

The steps are simple enough: (a) navigate to the next page in the test plan, (b) wait until it is fully loaded, (c) highlight a piece of text on the page, then (d) execute the above command sequence (or use the Ctrl-Y shortcut). The resulting script then has a synchronization step that has to be satisfied before every action -- and this will assure fully synchronized playback.

Additional Note: In certain rare cases for AJAX applications you may need to resort to other, more powerful, DOM-based synchronizations if the recording protocol described above doesn't work. Just look up "Synchronization" in the eValid User Manual for complete details on this.

No comments: