Reputation: 153
I am doing API REST Performance testing. For each API call, I have to send a unique Transaction and request ID in headers.
I use ${__UUID()}
in headers, and it's working fine.
To track the transaction id in server logs, I want to print that function( ${__UUID()})
generated value in a log file with API name. For that, I have tried many ways, but those are very complicated and messy. Without adding a preprocessor can we log the value of the transaction id value from the request header?
I would be grateful if you throw some light on this.
Upvotes: 0
Views: 1277
Reputation: 168147
If you want to have the generated GUID printed in jmeter.log file - just wrap it into __log() function like:
${__log(${__UUID()})}
This will both generate the GUID and print the corresponding line into jmeter.log file:
More information: Apache JMeter Functions - An Introduction
Upvotes: 1
Reputation: 369
I didn't understand why you don't want top use a preprocessor. I think it would be the best solution to generate the uuid in a script and store value before each request execution:
import java.util.UUID;
String uuid = UUID.randomUUID().toString();
log.info("Next uuid "+uuid);
vars.put("uuid",uuid);
Use the ${uuid} in your request header.
Upvotes: 2