Relative Content

Tag Archive for jmeter

How to get an array of random values from a DataBase table via JDBC and pass them as parameters to REST API JSON messages in Jmeter?

My JSON message body will have an array of 1 or more objects and each object in the array will be populated with few attributes. I need to populate the value for one of the attributes called ‘ID’ by obtaining a random value from PostGresSQL Database. I have done it successfully for 1 object in the REST API Message body – by generating a random number (Jmeter random variable), passing it to DataBase using a sql query via JDBC PreProcessor sampler to get the ID. It works fine when there is only 1 object in the array but I am unsure how to pass & get more values if the array has more than 1 object. Any help/suggestion would be helpful.
Thanks,
NP