I am stress testing application database. I have successfully setup JDBC connection configuration and able to execute queries. The requirement is: Insert new customers in customer_table in a database. Customer ID(which is a column name) should be unique and in sequential order. For e.g, In customer_table if 100 customers already exists then to add other customers the customer_id should begin with 101. So, In my test plan I need to first fetch the number of existing customers using Select query and then execute actual Insert query which is to be stress tested. So, I have added following to my test plan.
- A jdbc request with select query to get number of existing customers.(Only once in whole test plan) and save the number of customers in a variable name.
- A Counter element, where start value will be the variable name from first jdbc request and increment it by one.
- Actual JDBC request with insert query.
The problem with this approach is I need to execute the First request only once, irrespective of the number of thread count. Alternative approach I tried: I also tried creating two thread groups and passing the number of customer from first thread group to second thread group using Jmeter properties. But the second thread group is not able to access the customer count from first thread group which I have set as Jmeter property. Any help in appreciated.