BLOGCTA_TC_20130726_1_Testing_Ninja_936x110

TestComplete 4: Beginning Script Debugging – Running to the Cursor

This blog post provides some basic information for beginners to find and fix an exception error using the TestComplete 4 Run to Cursor debug feature.

Let’s take TestComplete’s Hello sample project, add script lines that raise an exception and then we’ll find it and fix it. In the following steps we will introduce an exception into TestComplete’s Hello sample project:

  • Start TestComplete 4 and click File on the Menu bar then select Open to display the Open Project dialog.
  • Navigate to …Program FilesAutomated QATestComplete 4SamplesScriptsHelloVBScript and single-click the Hello_VBScript.mds file to highlight it.
  • Click the Open button in the Open Project dialog. The Hello_VB script should automatically display in TestComplete’s Code Editor.
  • To introduce an error, navigate to script line 127 and type call "Close" and press Enter to drop the end sub to line 128.
  • Place your cursor on line 129 (or at the end of the script), then copy the following code and paste it to this line:






     

    To activate TestComplete’s debugger:

  • Click the Enable Script Debugging button on TestComplete’s Toolbar.

     

    To debug the script by running to the cursor, perform the following actions:

  • To run through the first routine, place the cursor at the end of line 27 behind the end sub.
  • Click the Run Script to the Cursor Position button on the toolbar or press F4.
  • The script should run through line 27 correctly.
  • To run through the second routine, place the cursor at the end of line 128.
  • Click the Run Script to the Cursor Position button on the toolbar or press F4.
  • An Exception Occurred error now displays, click OK to go directly to the script log.
  • Click the Hello_VB tab in TestComplete’s Workspace to display the script.
  • Click in the edit window and navigate to line 127, then delete the " " characters from this line.
  • Now that the " " characters are deleted we will run through the process again.
  • Place the cursor at the end of line 27.
  • Click the Run Script to the Cursor Position button on the toolbar or press F4.
  • The script should run through line 27 correctly.
  • Place the cursor at the end of line 128.
  • Click the Run Script to the Cursor Position button on the toolbar or press F4.
  • The script should run through line 128 correctly.
  • Place the cursor at the end of line 134.
  • Click the Run Script to the Cursor Position button on the toolbar or press F4.
  • The script runs correctly and the Script Log displays without errors.

     

    You can find more help with running to the cursor in the TestComplete 4 Running to the Cursor help file topic. You can access it by the help file’s table of contents (Using TestCompleteScriptingDebugging ScriptsRunning to the Cursor).

Speak Your Mind

*