Code’s value

Performance testing is often all about the “tool”. Loadrunner, JMeter, Gatling, the list grows day by day. However, across all of them a programming language is used to action assertions, validation, reading and writing data and many more things.

Conditional Statements

If - Provide a method of checking that a condition has been met before executing a step.

Greater Than - Provides a method of validating a value is greater than the condition supplied.

Less Than - Provides a method of validating a value is smaller than the condition supplied.

Greater Than or Equal to - Provides a method of validating a value is greater than or equal to the condition supplied.

Less Than or Equal to - Provides a method of validating a value is less than or equal to the condition supplied.

Loops

For - Provides a method of looping where a range of values are supplied which are incremented on each loop and re-validated. Validated at the top of the loop.

While - Provides a method of looping where a range of values are supplied which are incremented on each loop and re-validated. Validated at the bottom of the loop.

File Usage

fopen | open | File | File.Open - Provides a method of opening files to read or write across programming languages.

Data Extraction

Regex - Provides a method of targeting data through pattern matching. The syntax remains similar across all implementations.

Boundary Extractors - Provides a method of targeting data through pattern matching normally by supplying a left and right pattern to match and then returning the value between them.

XPath - Provides a method of targeting XML data through pattern matching against the XML structure.

JSON - Provides a method of targeting JSON data through pattern matching against the JSON structure.

Functions

strstr - Provides a method of targeting a sub string within a string. This can be useful for string manipulation or to extract values that couldn’t cleanly be targeted by the data extraction methods.

rand - Provides a method of generating a random value. You can get numeric and string versions of these commands.

function() - Provides a method of grouping actions and calling them at specific points in time.

uuid - Provides a method of creating a unique identifier. Typically like a series of values separated by a - symbol.

Summary

Various languages are used across the plethora of performance testing tools available in the world. However, regardless of the language there will be equivalent commands to the aforementioned. Always consider using code to enhance your test assets.

Previous
Previous

Octoperf

Next
Next

Performance fundamentals