Database Test Plan with JMeter


Outline

This post explains how to create JMeter Database Test Plan.

Prerequisites

JMeter & Java JDK download and setup

Database Test Plan Scenario

You will create 5 users that send (1) SQL requests , (2)times  to the database server. That means 5*1*2  – > totally  10 JDBC request will be send.

  • Add user
  • Add JDBC requests
  • Test Results

1- Add user  

First of all I changed my test plan name as “JDBC Test Plan”. Select Test Plan, clicking your right
button to get the Add menu, and then select Add -> ThreadGroup

JDBC_Test_Plan

Now I need MySQL database  , sample table. Now I ll create “testdb” , “worker” as table.

You can download MySql Community edition from here. Later we created sample database and table.

database

Some data insert into worker table

worker_table

Ramp-Up Period, leave the the default value of 0 seconds. This property tells JMeter how long to delay between starting each user. If you set the value to 0, then JMeter will immediately start all of your users.

jdbc_total

2- Add JDBC requests

We need to add JDBC Users element. Select Add -> Config Element -> JDBC Connection Configuration.

jdbc_connection

This example uses the MySQL database driver. Download MySQL Connector jar file from this link http://www.mysql.com/products/connector/ .Extract the zip file and copy .jar file to the JMeter lib directory.

mysql_jar

Now we can configure JDBC connection:

Database URL: jdbc:mysql://localhost:3306/testdb
JDBC Driver class: com.mysql.jdbc.Driver
Username: “your MySQL username”
Password: “your MySQL password”

connection

Select  JDBC Users element Add menu, and then select Add -> Sampler -> JDBC Request

jdbc_request

select_jdbc

3- 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 Graph Results listener (Add -> Listener -> View
Results Tree).

result_tree1

result_tree_2

Regards

javafx

Database Operations in JavaFX

By Onur Baskirt / Apr 1, 2016 / 56 Comments
Before started this section, please check the first article and learn How to Start JAVAFX! http://www.swtestacademy.com/getting-started-with-javafx/ At first, part of JavaFX tutorial series, we created a sample JavaFX project, designed the draft version of the UI and set up an...
extentreports

How to Write Smart XPath Locators

By Onur Baskirt / Sep 24, 2017 / 5 Comments
Hi all, in this tutorial, I will describe you how to write smart and non-brittle XPath locators. When we write our test scripts, we generally prefer to use id, name, class, etc. these kinds of locators. However, sometimes we could not...
extentreports

How to Write Effective CSS Locators

By Onur Baskirt / Oct 1, 2017 / 0 Comments
Hi all, in this tutorial, I will describe you how to write effective CSS locators to interrogate web elements for your automation projects. As a rule of thumb, your interrogation strategy should be in below order: First try to use...
rest assured

REST API Testing with Rest Assured

By Onur Baskirt / Mar 8, 2016 / 32 Comments
Outline In this post, I will explain what is API and API testing, what is the difference between SOAP and REST services, and how to test REST APIs with Rest Assured Library. What is API? API stands for Application Programming...
javafx

Getting Started with JavaFX

By Onur Baskirt / Mar 25, 2016 / 0 Comments
When I started to work in my current position, one of my task is to do manual operations for campaign products  every week. After the second week, I thought that I have to automate this task using a GUI based...
extentreports

Selenium-1: Quick Start to Automation with Selenium WebDriver & JAVA & JUnit & Maven & IntelliJ

By Onur Baskirt / Sep 8, 2015 / 26 Comments
Outline Selenium Webdriver is the most popular open source web test automation framework across the wide range of browsers and platforms. In this tutorial, you will learn how to do web test automation with Selenium Webdriver and the related tools....
extentreports

Selenium-11: Execute JavaScript with JavascriptExecutor

By Onur Baskirt / Jan 27, 2016 / 15 Comments
Outline Sometimes we cannot handle some conditions or problems with Webdriver, web controls don't react well against selenium commands. In this kind of situations, we use Javascript. It is useful for custom synchronizations, hide or show the web elements, change...
page object model

Page Object Model with C#

By Ege Aksoz / Jun 18, 2017 / 8 Comments
In the previous tutorial, we’ve taken the initial steps and entered the world of automated testing. We also wrote our first automated test. From this point on, since we are not just going to write one test, we need to...
extentreports

How to Select a Date From DatePicker Using Selenium

By Onur Baskirt / Aug 13, 2016 / 6 Comments
When you need to automate a airway, hotel, or similar websites you need to deal with Datepickers and some times it is a little bit cumbersome to select a specific date on the Datepicker or calendar.  In this post, I...

Getting Started with RobotFramework on Windows

By Onur Baskirt / Apr 25, 2016 / 12 Comments
What is RobotFramework? RobotFramework is a GENERIC test automation framework for acceptance testing and acceptance test-driven development (ATTD). What it means that you can do web, mobile, desktop and other test automation activities with related test libraries. These libraries can...
By | 2017-10-22T02:38:19+00:00 January 3rd, 2016|Jmeter, Performance Testing|0 Comments

About the Author:

Onur Yazir
Onur YAZIR is a Senior Software Testing & Deployment Engineer 7+ years of experience. He has worked at Huawei, Ericsson, Teknosa as Software Test Engineer. After that, he worked as DevOps Engineer at London-based fintech company EFT Software. Now, he is a DevOps Engineer at Gulf News Dubai Office. You can find detailed information about him on his linked-in page.

Leave A Comment