📚 LLM HUB · 2 PROMPTS
Groovy & JSR223 Scripting
2 copy-ready AI prompts for groovy & jsr223 scripting in JMeter, k6, and Gatling. Part of the JMeter.AI LLM Hub.
Groovy Pre/Post Processor Templates
Generate Groovy scripts for the following JSR223 use cases in JMeter:
1. PreProcessor: Generate HMAC-SHA256 signature for request signing
- Inputs: request body (${requestBody}), secret key (${apiSecret})
- Output: JMeter variable ${signature}
2. PostProcessor: Parse nested JSON and extract a list of IDs into separate variables
- Input: Response body with array $.items[*].id
- Output: ${itemId_1}, ${itemId_2}, ... ${itemId_N} and ${itemId_count}
3. PreProcessor: Log request details to a custom file per test run
- Include: timestamp, thread name, sampler label, iteration count
Include error handling and use JMeter API (vars, props, log) correctly.Groovy HTTP Client in JSR223
I need to make a secondary HTTP call inside a JSR223 Groovy script (not as a separate JMeter sampler) to:
- GET [URL] to fetch a lookup value
- Store the result in a JMeter variable ${lookupValue}
Generate the Groovy script using:
1. JMeter's built-in HTTP client (org.apache.http)
2. Java's HttpURLConnection
3. Groovy's built-in HTTP support
Show all three approaches and recommend the best one for JMeter performance.