Skip to content

Search and Replace

To create a dynamic Virtual User, you may need to extract some parameters (e.g. session ids, searched string, item added to a cart, etc.) from HTTP responses and inject them back in subsequent requests.

To help you doing so, OctoPerf provides a Search HTTP Actions feature:

Search HTTP Actions

Tip

You can click on the magnifier icon or one the lock icon to lock the Search and replace panel in opened position.

The following procedure explains how to search in HTTP Request Actions:

  1. Fill in the text to search,
  2. Click on the Search button,
  3. Green ticks appears on the right of actions that match the searched text.

Matching Actions

Note

The process of searching for parameters, placing extractors and injecting variables can be automated using Correlation Rules.

Info

You can use the Previous and Next links to browse the search results.

You can configure more precisely where to search by clicking on the Configuration button.

There you can select if you want to search for values in HTTP requests or responses by using the combo box on the right.

You can also access the advanced search mode by selecting Advanced:

Advanced Search HTTP Actions

This mode lets you do more precise searches:

  • You can specify the kind of matching to look for (Contains, Equals, Starts with, Ends with, etc.)
  • You can select where to search for the given term:

  • Select Recorded response and Check response to find out where to place Regexp Extractors.

  • Select request parts (query parameters, url path, headers, etc.) to find out where to inject the extracted variables (using the ${...} syntax).

  • You can search for request with a response assertion.

  • You can search for request with a variable extractor (and can even specify its name).

Note

We flag requests that match ANY of the given criterion.

The search operation is automatically done when you close the Configuration panel. You do not need to click on the Magnifier icon.

Replace

Replace options

To access the Replace Options:

  • Click on the Configuration button in the Search HTTP Actions panel,
  • The Configuration window opens,
  • Click on the Replace tab.

Replace configuration

By default the replace configuration uses a String replacement function initialized with the search term. It lets you replace the value string with the replacement one anywhere in the HTTP request actions:

  • In the action path,
  • In the URL query parameters (key and value),
  • In the HTTP headers (key and value),
  • In the POST data.

When done configuring the replacement, simply close the configuration windows and use one of the Replace buttons.

Replace operations include:

  • Replacing values for all flagged actions (actions identified during a search),
  • Replacing values for ALL HTTP actions of the currently opened Virtual User,
  • Replacing values for the currently selected HTTP action.

To replace values for all flagged actions, do a Search by selecting a value in the search term field and clicking on the Magnifier icon. Then click on the Replace Flagged button. Values in every HTTP action with a green tick are replaced.

To replace values for all HTTP Actions, simply click on Replace All when no search has been done or when no result has been found. You can clear the current search result by emptying the search term field and clicking on the Magnifier icon.

To replace values for one single HTTP Action, simply select an action in the Virtual User and click on the Replace button.

Note

If you click on either Replace, Replace All, or Replace Flagged buttons without previously configuring the Replace functions, the configuration panel automatically opens.

Advanced replace options

You can also use advanced replacement functions, for more specific use cases.

The replace feature help you replace various HTTP actions values such as:

  • Regular expressions,
  • Think times,
  • Servers,
  • Advanced Configuration,
  • Query parameters,
  • HTTP Headers.

Advanced replace configuration

Note

All Replace Functions are applied at once.

Headers and query parameters are replaced if they already exist.

You can use variables in headers and query parameters values.

Apply Replace Options

Upon applying the replace options you have selected, you can use two modes:

Replace All

Replaces all occurences in the current virtual user.

Switch to Replace Flagged by searching for something.

Replace Flagged

Replaces only occurences highlighted in the current search results.

Switch to Replace All if you empty the search field and hit the magnifier icon.

Remove

It is possible to remove particular requests by removing servers, but this impacts the entire project, and sometimes you only want to remove a subset of requests inside a particular virtual user.

The search and replace offers a more flexible way through the use of the remove option.

Typically you could search for a specific hostname like this:

Search hostname

Then launch the search as usual and wait for it to complete:

Search HTTP Actions

And once you hit the remove button all the occurrences will be cleared:

Bulk remove actions

Warning

This action cannot be reversed, make sure to duplicate your virtual user or double-check the search results before removing them.