Working with database in JMeter – User friendly Tech help

Scenario:- Creating a database test plan, such that we can do the performance testing for CRUD operations.
n
nSolution:-
nKey Points:- 
n1. JDBC connector files(jdbc jar).
n2. Database connection details, so we can communication with database.
n3. JDBC request, this is important to set the database connection details in jmeter
n
nStep1:- Download the required connector file and place in lib folder of jmeter
nFor our example we have taken mySQL db, so we need the relevant connector(jar file).

n

Extract and place the file inside the lib folder in jmeter 

nn

n
nStep2:-Add users as we did in our first test case.
n
nStep3:-JDBC Connection configuration,establishing the connection of jmeter with database.
n
nRight click “Thread Group” > ADD > Config element > JDBC Connection configuration
nFill the variable name, database name, driver details, and access credentials for the database.
n
n
Step4:-Use JDBC request to communicate with database and execute CRUD operations.
n
nRight click “Thread Group” > ADD > Sampler > JDBC request.
n
nUse the same Variable Name as we used in Step3, why ? as it tells jmeter to use the given connection string and its adds flexibility that in future we can use different connection string by adding new jdbc configuration and updating the variable name in jdbc request.
n
nAdd the CRUD operation (query)

n

n

n

n

n

n

n

n

n

Note:- In working code we have added extra “Regular Expression Extractor”, just to extract a given value from the response of query and add that value to a variable that we can use in the future requests.
n
Step5:-Add reporting.
n
nStep6:- Run 🙂
n

n

Working Code

Was this article helpful?
YesNo

Similar Posts