Starting from version 14.0, the Code Explorer panel is hidden from the TestComplete UI by default. To make the panel visible, select View > Select Panel from the TestComplete main menu, and then select Code Explorer. |
The Code Explorer panel contains all the script functions and procedures used in all the projects of the current project suite. Using the Code Explorer panel you can:
-
View code metrics,
-
Open a script unit or a specific function in the Code Editor,
-
Run script functions,
-
And more (see below).
To show the Code Explorer panel if it is hidden:
-
Select View > Select Panel from the TestComplete main menu.
-
Select Code Explorer from the panel list and click OK.
The script unit elements are displayed in the Code Explorer with one of the following icons:
-
- A script procedure (a routine that does not return a value), or a VBScript class’s method.
- - A script function (a routine that returns a value).
Note: JavaScript, JScript and Python functions are displayed with the icon. - - A VBScript class.
- - A VBScript class’s field.
- - A VBScript class’s property.
Working With Code Explorer
To open a script unit or routine in the Code Editor
-
Double-click the script unit or routine.
-- or --
-
Select the script unit or routine and press Enter.
-- or --
-
Right-click the script unit or routine and select Show Source from the context menu.
When jumping to a script routine, TestComplete opens the appropriate script unit and sets the insertion point on the routine’s first line.
To copy a routine to another unit
-
Select the desired routine and press Ctrl+C, or choose Copy from its context menu.
-
Select the destination script unit and press Ctrl+V, or choose Paste from its context menu.
-- or --
-
Select the desired routine.
-
Press Ctrl and hold it pressed while dragging the routine to the destination unit.
Note: | Drag-and-drop copying of script routines is only possible if the Code Explorer panel contents are unsorted. |
To move a routine to another unit
-
Select the desired routine and press Ctrl+X, or choose Cut from its context menu.
-
Select the destination script unit and press Ctrl+V, or choose Paste from its context menu.
-- or --
-
Drag the routine to the destination unit.
Note: | TestComplete also moves comment lines that reside before the routine. |
Note: | Drag-and-drop moving of script routines is only possible if the Code Explorer panel contents are unsorted. |
To add a routine to the project’s test items
-
Drag the routine from the Code Explorer to the Test Items editor opened in the Workspace.
To delete a routine
-
Select the desired routine in the Code Explorer panel and press Del.
To run a routine
-
Right-click the routine and select Run This Routine from the context menu.
Note: | A script routine can be run in this way only if it has no parameters and if the script unit where the routine is implemented contains no syntax errors. |
To jump to a script line containing a syntax error
-
Double-click the unit displayed with the error icon () in the Code Explorer panel.
-- or --
-
Double-click the Error node that is shown under the unit node.
TestComplete will open the script unit containing the error, and place the cursor on the erroneous statement. See also Checking Syntax.
To jump to a script line containing an issue
TestComplete detects potential problems in the script code of all project units, and lists the issues under the [Code metrics] node (see Code Metrics). To jump to the script routine or a line that contains an issue:
-
Double-click the issue item in the Code Explorer panel.
-- or --
-
Right-click the issue item in the Code Explorer panel and select Show Source from the context menu.
TestComplete will open the script unit containing the issue, and place the cursor on the problematic routine or statement.
To perform source control operations over a script or project
-
Use the Check In, Check Out, Get Latest Version and other commands of the panel’s context menu.
For more information about working with projects stored in source control systems, see Integration With Source Control Systems.
To sort the panel contents
By default, the items in the Code Explorer panel are not sorted. You can sort them by selecting Sort Ascending or Sort Descending from the context menu. Selecting the No Sorting context menu item will cancel the sorting. See also Sorting.
To expand or collapse all items
-
Select Expand All or Collapse All from the context menu of the Code Explorer panel.
See Also
Code Editor
Code Metrics
Checking Syntax
Code Explorer Options Dialog