We have recently released a new feature that allows JMeter to access the RedLine13-assigned Test ID as well as the Server ID directly from the test plan. If you already know how JMeter exposes options set at the command line, accessing this information will be familiar. (Otherwise, you may want to refer to this post for some additional context.) This information will be undoubtedly useful for a variety of purposes. However, one specific example would be in conjunction with using third-party integrations to visualize your test metrics, as something we have covered in a previous blog post (e.g., using InfluxDB and Grafana).
To review the command line syntax for importing JMeter custom properties, let us consider the following expression:
-J[prop_name]=[value]
|
Tests run through RedLine13 now internally add two properties to the JMeter command line: serverid for the unique ID of the load agent instance, and testid containing the sequential RedLine13 test number. This makes them accessible from JMeter test plans through a number of different ways, however the most straightforward means is using the built-in “__P()” function and ${…} notation.
If this fits your use case, you can enter ${__P(rl13_serverid)} and ${__P(rl13_testid)} into samplers, header and parameter tables, and many more places with no actual code required. An example of this can be found below, which echoes both properties to another web request:
In the event that you need to access these properties from within a script (e.g., BeanShell or JSR223) the process is similar, but the notation is slightly different. Instead, use the built-in props object by invoking “props.get(“rl13_serverid”)” or “props.get(“rl13_testid”)” as outlined in the JMeter documentation here. A simple example that assigns these properties to values is as follows:
String __serverid = props.get(“rl13_serverid”); String __testid = props.get(“rl13_testid”); |
This is of course a basic example providing access to test and server ID properties within your test plan. If you do not already have an account, you can sign up for a free RedLine13 trial subscription which will allow you to test out this feature for yourself.