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:
In the Code Editor, open the needed script unit and locate the line where the variable or function is declared.
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 function
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
A script containing a renamed function
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.