Interview Questions

WinRunner: Recording tips:

Mercury WinRunner FAQ


(Continued from previous question...)

WinRunner: Recording tips:

. Always record in Context Sensitive mode.
. WinRunner is case sensitive, so be careful in your scripting regarding what is put in upper/lower case.
. If using the full check text test case, make sure you add a filter to block items such as a date, user ID (which might vary depending upon the time the script is running and who is running it).
When recording in Analog mode, avoid holding down the mouse button if this results in a repeated action. For example, do not hold down the mouse button to scroll a window. Instead, scroll by clicking the scrollbar arrow repeatedly. This enables WinRunner to accurately execute the test.
Before switching from Context Sensitive mode to Analog mode during a recording session, always move the current window to a new position on the desktop. This ensures that when you run the test, the mouse pointer will reach the correct areas of the window during the Analog portion of the test.
When recording, if you click a non- standard GUI object, WinRunner generates a generic obj_ mouse_ click statement in the test script. For example, if you click a graph object, it records: obj_ mouse_ click (GS_ Drawing, 8, 53, LEFT); If your application contains a non- standard GUI object which behaves like a standard GUI object, you can map this object to a standard object class so that WinRunner will record more intuitive statements in the test script.
Do not Save in the test procedure unless it is absolutely necessary, this will prevent the need to write numerous clean up scripts.
Do not use the mouse for drop down selections, whenever possible use hotkeys and the arrow keys. When navigating through a window use the tab and arrow keys instead of using a mouse, this will make maintenance of scripts due to UI changes easier in the future.
. If recording on a PC, make sure the environmental settings are set up correctly. Use the Control Panels -> Regional Settings window to make sure that the date format, number formatting, currency, time and date are set the same for all PC's that will be using the scripts. This should be done to ensure that playback of test cases do not fail due to a date, currency or time differences. The best way to handle this is to record a small script to set the correct settings in the Control Panel Regional Settings window.
. If recording on a PC, make sure that all workstations running the scripts have the same Windows Display settings. By setting the PC's window appearance, and display settings the same, this will help ensure that bitmap comparisons and other graphic tests do not fail due to color and size differences. The best way to handle this is to record a small script to set the correct settings in the Control Panel Display Settings window.
When recording, if you click on an object whose description was not learned by the RapidTest Script wizard, WinRunner learns a description of the object and adds it to a temporary GUI map file.
. WinRunner does not compile the scripts until run time, so be careful to check your code before running it. Another option is to put your script in debug mode and step through the code to make sure it will compile correctly.
. Please Indent "if" statements and loops, to help make the code more understandable.
. To add a new object(s) to a GUI map that already exists; perform the following steps:
1. Ensure the no GUI Maps are loaded in the GUI Map Editor.
2. Do a simple recording that will include the object you need added to the GUI Map. This will put the object into the TEMP GUI Map.
3. Go into the Temp GUI Map and delete objects that are already contained in the existing GUI Map.
4. Go into the GUI Map Editor and load the existing GUI Map.
5. Use the Expand button to display two panels on the window.

6. Using the Copy button, copy the values in TEMP into the existing GUI Map. 7. Save the GUI Map file on the network in J:\CorpQATD\TD_Daybr\GUImap . (or substitute TD_web with whatever machine you are currently working on).
. While scripting and debugging your script it is a good idea to put a load command for the Web Function script at the top of your script and an unload at the bottom of your script. This code will automatically load the function library when you run your scripts, thus saving you the extra step when you try to debug your scripts. It is very important to remember to comment out the lines when you are done debugging/developing.
Below is a sample of code you can use.
#this is here for debugging only, when run in shell script will comment out.
#reload ("J:\\CorpQATD\\TD_web\\functions\\Webfunctions");
#this is here for debugging only, when run in shell script will comment out.
#unload ("J:\\CorpQATD\\TD_web\\functions\\Webfunctions");
. If you create a script by copying and existing one as save as, make sure to go into windows explorer to delete the exp and res folders. You could carry with you extra files you don't need.

(Continued on next question...)

Other Interview Questions