Searching and replacing text in tests

With the Test Search function, you can search for text in a test or search within specific test elements and optionally replace the found text.


  1. In the Test Navigator, browse to the test and double-click it. The test opens.
  2. Right-click the test name, and then select Test Search.
  3. In Search for text, type the text to locate.

    You can leave this field blank, depending on your search strategy. For example, if you know that a string occurs in elements or element instances that you are not interested in, by using the options described in steps 4, 6, and 8, you can locate the elements or element instances of interest before entering the search text into this field.

  4. If you have selected pages or requests within the test, click More Options, and then select Restrict search to elements highlighted in Test Contents. This restricts the search to the selected pages and requests.
  5. To perform a case-sensitive search, select Case sensitive. To search with regular expressions, select Regular expression. In regular expression mode, press Ctrl and type a space in Search for text for content assistance. Content assistance lists the regular expression patterns and the content that they match.
  6. To highlight found elements in the Test Contents area, click More Options, and then select Highlight found elements in Test Contents. You can use this option with the option that is described in step 4 to designate the element instances of interest before specifying the text of interest.
  7. To have the search include children of the selected element, click More Options, and then select Recursive. This option is selected by default. If Recursive is cleared, then only the selected element is searched.
  8. To have the search locate both encoded and decoded versions of the specified text, click More Options, and then select Match encoded and decoded values. This option is selected by default. The type of encoding that the search supports varies depending on the protocol. For example, when searching in HTTP data, abc%123 and abc%25123 match.
  9. In the Elements to search list, select all test elements to search.

    Selecting the check box in step 4 restricts the elements that you can select in this step to the instances that are selected in the Test Contents area. For example, if you select HTTP Pages here and only one page is selected in the Test Contents area, only that page is found. If the check box in step 4 is cleared, every test page is found.

  10. Optional: Click selected elements to define how to search them.

    A new area opens, where you can define how to search a selected element.

    To locate items, continue to the next step. To replace found strings, click Replace, and go to step 12.

  11. Click Search. The results of your search are displayed in two views
    • The Search view, which lists the objects that contain matches
    • The Test Search Match Preview view, which displays the matches that were found
  12. In the Search view, complete any of these search actions:
    • To preview a found string in the Test Search Match Preview, click the object.
    • To open your test at the location where an instance is found, double-click the object.
    • To perform a different search action (such as proceed to the next match or previous match, replace), right-click the object, and select your choice.
  13. If you clicked Replace in step 9, the Replace window opens. In the With field, type the replacement text.
  14. Select the replacement action by clicking the appropriate push button. If you are making selective replacements, found instances are displayed in the same order as in the Test Search Match Preview view. Click Replace or Skip until all found instances have been displayed.