AJAX support
IBM Rational Functional Tester supports testing AJAX-based Web applications.
You can test AJAX-based applications in two different ways; by setting the Auto Trace option to true or by setting the Auto Trace option to false.
Rational Functional Tester APIs for testing AJAX-based applications
The following APIs can be used in functional test scripts for testing AJAX-based applications. These APIs must be invoked on the HTML.Document test objects.
Method Description Example SetAjaxTrace(boolean) To trace the AJAX requests on the Document control document_htmlDocument().setAjaxTrace(true); GetAjaxPendingRequests () Returns the number of AJAX pending requests at any given point of time since the first AjaxTraceOn. document_htmlDocument().getAjaxPendingRequests();WaitForAjaxPendingRequests (int) To wait for the specified number of AJAX requests to be completed. Waits indefinitely till pending requests becomes zero, if the argument is not specified. document_htmlDocument().waitForAjaxPendingRequests(2); GetAjaxCompletedRequests () Returns the number of AJAX requests completed at any given point of time since the first AjaxTraceOn.. document_htmlDocument().getAjaxCompletedRequests(); WaitForAjaxCompletedRequests (int) To wait for the specified number of Ajax requests to be completed. document_htmlDocument().waitForAjaxCompletedRequests(4); For more information on these APIs, see the API Reference topics.
- Set up the environment for testing AJAX-based Web applications
You can test AJAX-based applications in two different ways; by setting the Auto Trace option to true or by setting the Auto Trace option to false. If you set the Auto Trace option to false, use the Functional Tester APIs for AJAX in the script by manually inserting them.- Enable AJAX support for a pre-existing script
The HTML Document control is mapped to GuiTestObject in Rational Functional Tester versions prior to 7.0.0.2. The GuiTestObject does not contain any AJAX-related APIs. To use the AJAX-related APIs, the HTML Document control must be mapped to DocumentTestObject.