Monday, March 12, 2007

Debugging the Test Script

After enhancing a test with programming elements, you should check that the test
runs smoothly, without errors in syntax and logic. WinRunner provides debugging
tools which make this process quick and easy.
You can:
• run the test line by line using the Step commands
• define breakpoints that enable you to stop running the test at a specified line or
function in the test script
• monitor the values of variables and expressions using the Watch List
When you debug a test script, you should run your test in Debug mode. (To run a
test in Debug mode, select Debug from the Run Mode list on the Standard
toolbar.) The test results are saved in a debug directory. Each time you run the
test in Debug mode, WinRunner overwrites the previous debug results.
In this exercise you will control the test run using the Step command. If any error
messages appear, examine the test script and try to fix the problem.
1 Select Debug mode from the Run Mode list on the Standard toolbar.
Debug mode will remain in effect until you select a different mode.
2 Place the execution marker –> next to the first line in the test script.
Click in the left margin, next to the first line in the test script.
3 Choose Run > Step or click the Step button to run the first line in the test script.
WinRunner runs the first line of the test.
4 Use the Step button to run the entire test, line by line.
Click the Step button to run each line of the test script. Note that your mouse pointer may sometimes move to the flight application as it clicks on objects during the test run.
5 Click Stop.
Click the Stop button to tell WinRunner that you have completed the Debug test run.
6 Review the test results in the WinRunner Test Results window.
When you run the test in Debug mode, the test results do not open automatically.
Choose Tools > Test Results or click the Test Results button. The WinRunner
Test Results window displays the results of the Debug test run.
7 Close the Test Results window.
Choose File > Exit.
8 Exit the Flight Reservation application.
Choose File > Exit.