Building a Database Test Plan With Jmeter
JDBC CONFIGURATION :
This example uses the MySQL database driver. To use this driver, its containing .jar file must be
copied to the JMeter lib directory .
➢ First check for JDBC DRIVER .
➢ If you dont have JDBC DRIVER then download “jakarta-jmeter-2.3RC3”.
➢ Search for this Jar file “mysql-connector-java-5.0.8-bin” and copy into following directory:
➢ C:\jakarta-jmeter-2.3RC3\jakarta-jmeter-2.3RC3\lib
➢ This Database test plan used with MySQL and consider the following to build a database test
plan.
Server Host : localhost
Username : root
Password : root
Database Name : testdata
➢ Go to : C:\jakarta-jmeter-2.3RC3\jakarta-jmeter-2.3RC3\bin and click on jmeter.bat batch file.
➢ Now you can show user interface of Jmeter.
1) Adding User : The first step you want to do with every JMeter Test Plan is to add a Thread
Group element. The Thread Group tells JMeter the number of users you want to simulate, how often
the users should send requests, and the how many requests they should send.
-Go ahead and add the ThreadGroup element by first selecting the Test Plan, clicking your right mouse
button to get the Add menu, and then select Add --> ThreadGroup.
2) JDBC Connection Configuration :Begin by selecting the JDBC Users
element. Click your right mouse button to get the Add menu, and then select Add --> Config
Element --> JDBC Connection Configuration.
Set up the following fields (these assume we will be using a local MySQL database called testdb):
Set up the following fields (these assume we will be using a local MySQL database called testdb):
• Variable name bound to pool. This needs to uniquely identify the configuration. It is used by the
JDBC Sampler to identify the configuration to be used.
• Database URL: jdbc:mysql://localhost:3306/test
• JDBC Driver class: com.mysql.jdbc.Driver
• Username: root
• Password: root
3) JDBC Request : Selecting the JDBC Users element again. Click your right mouse
button to get the Add menu, and then select Add --> Sampler --> JDBC Request.
Start by editing the following properties :
Enter the Pool Name: MySQL (same as in the configuration element)
Enter the SQL Query String field.
4)Adding the Listener to View / Store the Test Results :
The final element you need to add to your Test Plan is a Listener . This element is
responsible for storing all of the results of your JDBC requests in a file and presenting a
visual model of the data.
Select the JDBC Users element and add a View Results Tree listener :
(Add --> Listener --> View Results Tree).
5) Displaying Different types of Result :
Now go to : Run--> Start (Ctrl + R) and you will get different types of results.
6) DisplayView Results in Table
Add --> Listener --> View Results in Table
7) Display Summary Report
Add --> Listener --> Summary Report
8) Display Spline Visualizer
Add --> Listener -->Spline Visualizer