Use the Replace dialog to search for and replace data in your tests. To call the dialog:
Select Edit > Replace from the main menu of TestComplete.
– or –
Press Ctrl+H (the shortcut can be changed in the Customize Keyboard dialog).
In the Find what box, enter the text to be found and replaced. You can either type the needed text or select it from the list of phrases you searched for earlier. The Find what box may include wildcards (* or ?) or regular expressions. Using regular expressions, you can search for multiline text (see below).
In the Replace with box, enter the replacement text or select it from the list of strings you entered earlier.
In the Look in list, specify where TestComplete will search for the text. The possible values are:
|Current Document or Panel||TestComplete will search for the specified item in the active editor.|
|Project Suite||TestComplete will search for the specified text in all project items of all projects of your project suite.|
|Open Documents||TestComplete will search for the specified text in all editors opened in the Workspace.|
|Selection in Current Document or Panel||TestComplete will search for text in the selected block in the currently active editor.|
|In the Keyword Test editor, the dialog can find and replace text only in the Value column. You cannot use the dialog to find and replace operations in keyword tests.|
Use the following options to set additional search conditions:
|Match case||Specifies whether the search is case-sensitive.|
|Match whole word||TestComplete will search for text that matches the sought-for string as a whole word, not part of a word.|
|Search in collapsed sections||(Available only if you search for text in script code.) Specifies whether TestComplete will search within collapsed code blocks.|
|Search up||TestComplete will start the search from the current cursor position or from the currently active panel and will go upwards.|
|Use||Specifies how TestComplete will treat the sought-for string: as a regular expression or as a string with wildcards.|
|TestComplete supports two standard wildcards: asterisk (*) and question mark (?). The asterisk corresponds to the string of any length, the question mark - to any single character.|
|Regular expression includes a lot of tokens and modifiers that let you specify complex search patterns. Using regular expressions you can search for text that reside on several text lines. To specify the newline symbols, use the
For complete information on supported regular expressions, see Regular Expressions Syntax.
Tip: You can use sub-expressions to replace only a part of the sought-for expression.
Suppose that a script unit includes the strings FileVersion 4,20,123 and FileVersion 4,20,124 and you need to replace 123 and 124 with 125:
To search for the first occurrence of the needed text, click Find Next. TestComplete will highlight the found text.
To replace the highlighted text, click Replace. TestComplete will replace the text and then will find the next occurrence.
To search for the next occurrence of the text without replacing the highlighted text, click Find Next again.
To find and replace all the occurrences on the needed text, click Replace All. TestComplete will replace all found occurrences of the text with the needed text and show the Search/Replace Results panel that lists all replacements made. In the panel, you can undo a replacement, if necessary.
TestComplete will also highlight all script lines and keyword test operation parameters containing the replaced text with the icon in the gutter.
To close the dialog, click Cancel.