Applies to TestComplete 12.60, last modified on September 17, 2018

In the Code Editor, you can perform code refactoring, that is, you can modify the code structure without changing its functionality or features. This allows you to improve code readability and create a more convenient architecture for your tested applications.

To perform refactoring, you can, for example, rename variables or routines declared in your script tests. TestComplete will change their names in all the scripts of your project. It will also change the variable or routine names in other project items that use them. For example, if you have a keyword test operation that calls a script routine, TestComplete will update the operation to call the routine by its new name.

To rename a variable or function:

  1. In the Code Editor, open the needed script unit and locate the line where the variable or function is declared.

  2. Right-click the variable or function name and then click Rename.

    In the subsequent dialog, specify a new name for your variable (or routine):

    Renaming a variable

    Renaming a variable

    Click the image to enlarge it.

    Renaming a function

    Renaming a function

    Click the image to enlarge it.

  3. Click OK.

TestComplete will change the name of your variable in all script units of your project, and will update the function in the entire project: in all script units, keyword tests, test items and other project elements.

TestComplete will highlight all the script lines and keyword test operation parameters containing the renamed variable or function with the icon in the gutter.

A script containing a renamed variable

The script after renaming the variable

Click the image to enlarge it.

A script containing a renamed function

The script after renaming the function

Click the image to enlarge it.

The replacement results will also appear on the Search/Replace Results panel at the bottom of the TestComplete window. To learn more about the panel, see the panel description.

See Also

Code Editor
Code Completion

Highlight search results