TestComplete 4: Beginning Script Debugging – Stepping Through Script Code
Test and Monitor | Posted January 12, 2006

This blog post provides some basic information for beginners to find and fix an exception error using the TestComplete 4 Trace Into 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 tracing the code, perform the following actions:

  • To step through the script, place the cursor at line 1.
  • Click the Trace Into button on the toolbar or press F7.
  • The cursor should jump to script line 31 and pause.
  • Click the Trace Into button on the toolbar or press F7.
  • The cursor jumps to script line 32 and pauses.
  • Keep clicking the Trace Into button on the toolbar or press F7 multiple times until the Exception Occurred error displays and click OK to go directly to the script log.
  • Click the Hello_VB tab in TestComplete’s Workspace to display the script.
  • The cursor should already be on line 127 since this is where the script failed.
  • Delete the " " characters from line 127.
  • Now that the " " characters are deleted we will run through the process again.
  • Click the Trace Into button on the toolbar or press F7 multiple times until you reach the end of the script and the Script Log displays without errors.

     

    You can find more help with stepping through the script in the TestComplete 4 Stepping Through Script Code help file topic. You can access it by the help file's table of contents (Using TestCompleteScriptingDebugging ScriptsStepping Through Script Code).


Close

By submitting this form, you agree to our
Terms of Use and Privacy Policy

Thanks for Subscribing

Keep an eye on your inbox for more great content.

Continue Reading

Add a little SmartBear to your life

Stay on top of your Software game with the latest developer tips, best practices and news, delivered straight to your inbox