I have created a custom jmeter java sampler that sends requests to an HTTP endpoint in a loop and parses the responses. Multiple threads are expected to run this sampler in a single thread group.
The requests are parameterized with an ID and I need every thread to lookup random name to ID mappings in a hashmap. I would like to load the mapping from a csv file at the beginning of a test.
It was suggested that I might use a beanshell sampler inside of a setup thread group to read from the csv, create the hashmap, and store it in a JMeter property using something like props.put()
. Can someone tell me if this is a reasonable approach and if so, how do I access the particular JMeter property inside the custom sampler?
I found this answer: Single thread initialization for Jmeter with multiple sampler which hints at what I'd like to do but does not provide details.