Skip to content

Functions Usage

Since OctoPerf operates JMeter in the background, it is also possible to use JMeter functions. Functions are shortcuts you can use to avoid adding a script block into your virtual user. The same result can be achieved programmatically but they make life easier by handling a lof of common situations.


When a requests sends a timestamp in milliseconds, you can just replace it with: ${__time()} This way, the current timestamp will be send every time instead of the recorded/original value. It is also possible to get a timestamp in seconds using: ${__time(/1000)} Or many other date formats, be sure to check its documentation page for more details.

CSV Read

When the CSV variables are not enough for your requirements you can manually parse a CSV file using functions:


Check out our example on the CSV variable page for more details.


This is meant to implement a counter that can be shared between all users running. It will only increment when moving to the next iteration/loop of each user. Which means you can use it several times in a virtual user and its value remains consistent (at least until you get to the next iteration). It can be used this way: ${__counter}

More details can be found on its documentation page here.


A simple random function with a min and max value: ${__Random(0,10)}. You can store the random value in a variable for further use: ${__Random(0,10, variable)}.

Other random functions include the random date: ${__RandomDate()} and the random string (with length): ${__RandomString(5)}


Properties are values shared among all users running inside JMeter. The value of property propertyName can be used like this: ${__P(propertyName)}.

This can be used in combination with the runtime properties to control your scripts in real time while the test is running.

Nested variables

The ${...} syntax used for variables does not allow nested variables. When this happens we must use the __V function.


We already have a detailed example of a situation where this can be useful on the while page.


Sometimes strings must be encoded to be send over the network. Typically in a form-urlencoded post for instance. A good way to take care of that is to use the __urlencode function.

For example ${__urlencode(string th@t requires "encoding")} will return string%20th%40t%20requires%20%22encoding%22

Our correlation rules will use this function when encoding is set to Url encode.


__urldecode will do the exact opposite if you need to put the string back in a more readable format.