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:
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:
- Fill in the text to search,
- Click on the Search button,
- Green ticks appears on the right of actions that match the searched text.
The process of searching for parameters, placing extractors and injecting variables can be automated using Correlation Rules.
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:
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:
Check responseto 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
You can search for request with a response assertion.
- You can search for request with a variable extractor (and can even specify its name).
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.
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.
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.
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,
- Advanced Configuration,
- Query parameters,
- HTTP Headers.
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.
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:
Then launch the search as usual and wait for it to complete:
And once you hit the remove button all the occurences will be cleared:
This action cannot be reversed, make sure to duplicate your virtual user or double check the search results before removing them.