Scenario:- Creating a database test plan, such that we can do the performance testing for CRUD operations.

Solution:-
Key Points:- 
1. JDBC connector files(jdbc jar).
2. Database connection details, so we can communication with database.
3. JDBC request, this is important to set the database connection details in jmeter

Step1:- Download the required connector file and place in lib folder of jmeter
For our example we have taken mySQL db, so we need the relevant connector(jar file).

Extract and place the file inside the lib folder in jmeter 

mysql connector placed in lib folder jmeter



Step2:-Add users as we did in our first test case.

Step3:-JDBC Connection configuration,establishing the connection of jmeter with database.

Right click “Thread Group” > ADD > Config element > JDBC Connection configuration
Fill the variable name, database name, driver details, and access credentials for the database.
jdbc connection with jmeter

Step4:-Use JDBC request to communicate with database and execute CRUD operations.

Right click “Thread Group” > ADD > Sampler > JDBC request.

Use 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.

Add the CRUD operation (query)

jsbc request in jmeter

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.

Step5:-Add reporting.

Step6:- Run 🙂

Leave a Reply

Your email address will not be published. Required fields are marked *