Checking Syntax

Applies to TestComplete 14.40, last modified on April 22, 2021

Correct syntax of script code is important for most of TestComplete subsystems. For instance, if the syntax is incorrect, TestComplete may be unable to automatically generate correct names for new recorded script routines and new event handlers, or code navigation in the Code Editor will not work. Also, scripts holding syntax errors cannot be executed: TestComplete automatically checks the syntax of your script routines before executing them and if the check fails, TestComplete cancels the script run.

You can check the script syntax by right-clicking the desired unit in the Project Explorer panel and selecting Check Syntax from the context menu. TestComplete will highlight the syntax error (if any) in the Code Editor.

Check Syntax Menu Item

TestComplete also 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:

Error Description

To quickly jump to the first syntax error in a unit, right-click somewhere within the unit code and choose Go to Error from the context menu.

You can also locate syntax errors by using the Code Explorer panel. It shows the error icon () next to each unit and project containing syntax errors.

Note: By default, the Code Explorer panel is hidden from TestComplete. To make the panel visible, select View > Select Panel from the TestComplete main menu, and then select Code Explorer in the resulting Select Panel dialog.

Explore the tree the panel shows to find the unit with syntax errors quickly. To locate the problematic line in the unit, double-click the Error node that is shown under a unit node. TestComplete will open the unit in the Code Editor and place the cursor at the line with the error.

Code Explorer Showing an Error
Note: Syntax checking means that TestComplete parses the script code and finds errors. Since parsing of large units requires a lot of time, TestComplete displays the parsing status in its status bar and disables some menu and toolbar items during the parsing process. For example, you cannot start the script routine execution during the syntax checking.

See Also

Code Editor
About Code Editor
About Code Explorer
Code Completion

Highlight search results