Who knows how to use data from DB in queries in Jmeter? For example, there is a step - a precondition sampling from the database on JDBC, then there is an http request - into which I want to substitute these values. And if there are several threads, then it is necessary that the values from the database do not repeat (by analogy with reading from csv).
1 answer
Option 1:
- HTTP Request
- JDBC PreProcessor to pull value for current query at SQL level
Option 2:
- If Controller with the condition
${__threadNum} == 1 && ${__groovy(vars.getIteration() == 1,)}(so that the query is executed only once)- Test action
- JDBC PreProcessor to pull all values from DB
- Test action
- HTTP Request using the same __threadNum () or __counter () function so that each thread uses its own value.
Option 3: the same as Option 2, only using ForEach Controller to iterate through the query results
Option 4: Write the result of the query to a CSV file using Groovy and use the usual CSV Data Set Config
|