Web tests could fail because of improper System Configuration or because of change in target application since test was recorded. Find below details on how you can troubleshoot common Recording Failures and Replaying Failures.
Common problems user faces during recording are as follows :
In case you find that certain events in the test are not getting recorded then you need to configure and add new Web or Windows Element to the list of supported elements at Tools -> Options -> Web Test -> Web/Window Elements, First find out the tag name/native class attribute of that element using Object Spy. Once you identify the tag / native class of element you can add same to list of supported elements at Tools -> Options -> Web Test -> Web/Window Elements. Once you add the element to the list of supported elements and configure the required events for same you should be able to record events on it fine.
By default, application does not record mouse-over events on elements. If you have a web page which uses mouse-over event to do certain action, for example, in DHTML menu bars, where on mouse-over, menu opens into sub-menus, then you should have option "Auto Detect mouse-over events on elements having mouse-over event handlers" selected at Tools -> Options -> Web Test -> General Settings. If this checkbox is selected then during recording application tries to find the mouse over event handlers on the fly and records the mouse over event for the element which has mouse over event handler associated with it. In case the target element does not have mouseover handler and you still want to record mouse over event on that then you need to check the list of supported elements at Tools -> Options -> Web Test -> Web/Window Elements and see if mouse hover event is enabled for that particular element.
Application tries to validate starting URL before starting recording. This validation could fail because of one of the following reasons :
This generally happens when application uses local Proxy for Recording on non IE browser or while recording Load Test script simultaneously. Common reason of this is because of not being able to set proxy fine in the Target browser. In such cases you may need to set proxy manually in the browser. Refer to Proxy Recording chapter for details on the proxy settings configuration in browser. Also make sure that firewall is not blocking the port used to launch the local proxy and this port is not used by any other application on machine. By default application uses port 8690 for starting local proxy.
Another reason when this could happen is when you are trying to test application deployed on local server in which case you are using localhost in the starting URL. In such cases make sure to use IP of the machine in the starting url. So instead of using http://localhost:port/xyz you should use http://machine-ip:port/xyz as starting url where machine-ip is the IP address of the machine where target application is running.
While recording Web Test for Firefox or Safari or any non-IE browser, application starts a local proxy server and sets same in the browser. So first check that proxy is getting set fine in browser. Refer to Proxy Recording chapter for details on the proxy settings configuration in browser. Once proxy is set in browser this local proxy server injects each response with recorder javascript. This recorder javascript takes care of recording the events on web application. So if your application has javascript errors and if for some reason the page does not completely load in the browser then application will fail to record any event as the recorder script will be unable to load in that case. So make sure that your application runs without script errors when run normally outside of AppPerfect.
Flash application recording is supported only with Internet Explorer on windows. In general all the window specific components are supported only when recorded on windows platform using Internet Explorer. In case you need to test Flash applications in Safari or Firefox browser on Windows platform, you can use AppPerfect App Test product for same.
While recording keypress events on Web elements application records set api for any alphanumeric input on text elements. The non alphanumeric keys like Tab keys are not recorded by default. In general recording of these events are not required and hence is disabled. You can enable recording for non-alphanumeric keys like Tab keys by selecting "type" event for each of the Web Element at Tools -> Options -> Web Test -> Web Elements.
By default application does not record all the subframes in the page and only records those frames on which events are recorded. To save all subframes in page you should select the "Save All Frames" option at Tools -> Options -> Web Test -> General Settings.
Common problems user faces during replaying are as follows :
During replaying application uses a search algorithm to find the desired html element on the target web page. Application first tries to find the element at recorded element position also know as "tagIndex" It then compares the recorded attributes/properties of the element against the one it finds from element at recorded tag index. Now if some of the attributes does not match then application tries to find the matching element with maximum number of matching attributes in the vicinity of the recorded tag position. In case if application cannot find any element with matching attributes then report the event as failure. In such cases check that the recorded attributes are not changing during each run. If they are changing then you need to ignore same which can be done by selecting the Event in the Editor tree and ignoring the changing attributes on right hand side Attributes tab. You can refer to Results view and see the reason for failure for the event to find which attributes did not match for the element during replaying
Another common reason for this failure is that application did not wait for enough time to complete page initialisation and hence required element is not available when application tries to replay on same. In such cases you should replay test with "Ignore think time during replaying" deselected at Project -> Properties.. and providing appropriate think time for each of the step.
Also the failure could be genuine in case target application has changed since the test was recorded. So in case if the element's properties have changed since the test was recorded then you need to update the properties as explained in Object Spychapter.
Application tries to validate starting URL before starting replaying. This validation could fail because of one of the following reasons :
This could happen if there are multiple elements on the page having same attributes and element's position is changing during each run. In such cases application may end up matching attributes for different element and replay on that. So all the elements on the page should have unique properties like id or name so that AppPerfect can identify the elements uniquely during test run.
Another reason for this could be that the unique attribute for the element which could identify the element is changing. In such cases you can ignore that attribute and then replay the test with "Perform strict attributes comparision to find element during replaying" option selected at Tools -> Options -> Web Test.
Test could stop in between in case there are problems with the recorded script. This could happen if in case you have done any editing to the script to add custom code. In such cases application generally terminates script logging errors in the log files. Check the log files at $WebTest_Home/logs folder and see if you find test stopping because of script error. In case test stops due to scripting error then log file will show you the exact line number in script from where the script was terminated. Open Script Editor using Project -> Script Editor and go to that line number and see what is wrong with the script code. In case you have done any editing to the script to add custom code then make sure that you have followed all steps correctly as mentioned in Adding Custom Code to Test Script chapter.
This generally happens when application uses local Proxy for Replaying on non IE browser. Common reason of this is because of not being able to set proxy fine in the Target browser. In such cases you may need to set proxy manually in the browser. Refer to Proxy Recording chapter for details on the proxy settings configuration in browser. Also make sure that firewall is not blocking the port used to launch the local proxy and this port is not used by any other application on machine. By default application uses port 8690 for starting local proxy.
If application does not wait for enough time to complete page initialisation in such cases you should replay test with "Ignore think time during replaying" de-selected at Project -> Properties.. and providing appropriate think time for each of the step. In this case application will wait for specified think time before replaying each of the step.
By default application uses Web HTML apis to replay mouse events, but in some cases you may have underlying event handlers execute only if mouse cursor is hovered over the target element, like opening of a drop down menu or validation of form on mousedown/mouseup etc. In such cases you should replay test with "Use low level apis to replay mouse events on HTML elements" option selected at Tools -> Options -> Web Test. In this case application uses Low level mouse events during execution of events and moves cursor to centre of target HTML element while replaying.