testinganswers.com - One of the most popular software testing blog with best testing tutorials and interview questions. Latest and complete information on manual testing methodologies, automation testing tools and bug tracking tools.

In this chapter we will see how to create a simple test plan to test the database server. For our test purpose we have used the MYSQL database server. You can use any other database for testing. For installation and table creation in MYSQL.

Once MYSQL is installed, follow the steps below to setup the database:

First let's start the JMeter from /home/deepak/apache-jmeter-2.9/bin/jmeter.sh.

ADD USERS

Now create a Thread group, right click on Test Plan > Add> Threads(Users)> Thread Group. Thread Group will get added under the Test Plan node. Rename this Thread Group as JDBC Users.

We will not change the default properties of the Thread Group.

ADDING JDBC REQUESTS

Now that we have defined our users, it is time to define the tasks that they will be performing. In this section, you will specify the JDBC requests to perform. Right click on the JDBC Users element, selectAdd > Config Element > JDBC Connection Configuration.

Set up the following fields (we are using MySQL database called tutorial):

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. We have named it as test

Database URL: jdbc:mysql://localhost:3306/tutorial

JDBC Driver class: com.mysql.jdbc.Driver

Username: root

Password: password for root

The other fields on the screen can be left as the defaults as shown below:

Now add a JDBC Request which refers to the JDBC Configuration pool defined above. Select JDBC Users element, click your right mouse button to get the Add menu, and then select Add > Sampler > JDBC Request. Then, select this new element to view its Control Panel. Edit the properties as below:

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. We have named it as test

Name: Learn

Enter the Pool Name: test (same as in the configuration element)

Query Type: Select statement

Enter the SQL Query String field.

CREATE LISTENER

Now add the Listener element. 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.