In TestComplete you can debug script code and keyword tests. “Running to the cursor” is the easiest way to use the debugger. Select the first suspected spot, test up to it (that is, run at normal speed, no stopping), check that the state of the application, its output, and script or keyword test variables are as expected, and, if ok, select a new check spot to test up to. At each stop, the next statement to be executed is highlighted in the Code Editor or in the Keyword Test editor.
To start debugging, switch to the Code Editor or to the Keyword Test editor and place the cursor on the line (or operation) which you want to run your first check.
Then, start the run using either of these methods:
Press the Run to cursor shortcut key. By default, F4. See Key Mapping for information on how to change the shortcut.
Press Run To Cursor on the Debug toolbar.
Then, check the state of the script or keyword test, choose the new stop line or operation, and select Run to cursor again.
If your test consists of several script routines or keyword tests, you can run the test until the execution returns to the specified routine or test:
The test execution will continue until it reaches the selected routine or test and will pause on the script line that follows the last executed line of the selected routine or on the operation that follows the last executed operation of the selected keyword test.
Despite the fact that scripts and keyword tests can call each other, the Run to cursor command does not work if you are running a keyword test and call the command for a script line. If the keyword test calls a function in this unit, the execution flow will come to the function, but will not stop on the selected script line. Similarly, the command will not work if you are running a script and call the command for an operation in the keyword test that your script calls.
To work around the issue, set a breakpoint on the needed script line or keyword-test operation. The test debugger always stops on breakpoints.