This topic describes common tasks you can accomplish with scripts displayed in the Code Editor.
Run Routines
To run the desired routine, do any of the following:
- Right-click somewhere within the routine’s declaration and select Run This Routine from the ensuing context menu.
- Click somewhere within the routine’s declaration and click the button on the Code Editor’s toolbar.
Insert Checkpoints
To insert a checkpoint into the test, do the following:
-
Press the down arrow on the right of the Checkpoint button.
-
Select the needed checkpoint type.
-
Follow the instructions of the ensuing wizard.
-
Click Finish when you have specified all parameters for the selected checkpoint.
-
Click Copy in the Copy Text to Clipboard dialog.
-
Paste the text from the clipboard to the needed place in your script.
Debug Routines
To start debugging the desired routine, do the following:
-
Right-click somewhere within the needed routine’s declaration.
-
Select Debug from the ensuing context menu.
-
Select the needed action from the sub menu that appears.
For more information, see Debugging Tests.
Call Code Completion Window
To call the Code Completion window, do any of the following:
-
Right-click somewhere within the Code Editor and select Code Completion from the ensuing context menu.
-
Click somewhere within the code line and press CTRL + SPACE.
The Code Completion window may also pop up automatically when you are typing the text. For this purpose, enable the Auto Pop-Up option.
Obtain Parameters Description
To obtain the description of parameters that belong to the specified method or property, do the following:
-
Type the name of the property or method that has at least one parameter – for example,
Log.Message()
. -
Click within the brackets after the specified name.
-
Press CTRL + SHIFT + SPACE.
Check Syntax
TestComplete checks the syntax when you are typing in the Code Editor. It shows the error mark () in the gutter for problematic lines. To view the error description, place the mouse over this mark.
For more information, see Checking Syntax.
Insert Code Templates
To insert a code template, do any of the following:
-
Right-click within the Code Editor and select Code Templates from the ensuing context menu. As an alternative, you can press the CTRL + J shortcut within the Code Editor.
-
Select the name of the desired template and press ENTER.
-
If the selected template has at least one parameter, TestComplete will ask for their values.
-- or --
-
Type the name of the desired template and press Tab.
For more information, see Code Templates.
Navigate to Element’s Declaration
To navigate to the declaration of a routine, variable, constant, or name mapping object, do the following:
-
Right-click the name of the desired routine, variable, constant, or name mapping object in the Code Editor.
-
Select Go to Declaration from the context menu.
The routine, variable or constant declaration will be displayed in the Code Editor, whereas the name mapping object declaration will be displayed in the Name Mapping Editor.
As an alternative, you can select the desired routine from the list of the combo box on the Code Editor toolbar. For more information, see Code Navigation.
Insert Bookmarks
To insert a bookmark, do the following:
-
Right-click somewhere within the Code Editor.
-
Select Toggle Bookmarks from the context menu.
-
Select the name of the inserted bookmark from the ensuing sub menu.
For more information, see Bookmarks.
Call Editor Options
To call the options of the Code Editor, do any of the following:
-
Click the Call the Panel Options Dialog button on the Code Editor toolbar.
-
Right-click somewhere within the Code Editor and select Panel Options from the ensuing context menu.
Rename Entities
To rename variables and functions within your code, do the following:
-
Right-click the name of the entity you want to rename (that is, a variable or function).
-
In the context menu, select Rename Variable or Rename Function.
-
In the subsequent dialog, specify a new name for your entity.
-
Click OK.
For more information, see Renaming Functions and Variables.