Performing extensive search and replace

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

About this task

To perform an extensive search within a test:

Procedure

  1. In the Test Navigator, browse to the test and double-click it. The test opens.
  2. Right-click the test name, and select Test Search.
  3. In the Search for text field, 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, 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, select Restrict search to elements highlighted in Test Contents. This restricts the search to the selected pages and requests.
  5. To do a case-sensitive search, select the Case sensitive check box.
  6. To highlight found elements in the Test Contents area, select Highlight found elements in Test Contents. You can use this option with the option described in step 4 to designate the element instances of interest before specifying the text of interest.
  7. To have the search wrap to the beginning of the test, select Recursive.
  8. 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 not selected, every test page is found.

  9. Optional: Click selected elements to define to search them.

    A new area opens, where you can define how to search a selected element. The following example shows the search options that are available when you select HTTP Pages.

    Test Search Options dialog

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

  10. 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.
    The following figure shows the Search view. URL: Offset: 36 and URL: Offset: 85 designate objects in which the search text was found.
    Search results page
  11. 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.
  12. If you clicked Replace in step 9, the Replace window opens. In the With field, type the replacement text.
    Replace dialog box
  13. Select the replacement action by clicking the appropriate 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.

Feedback