Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Use database table as CSV dataset for JMeter

I am currently doing performance testing with JMeter for an application in my company. The application requires a login and I have to use multiple users. The way this is usually done in JMeter seems to be via CSV dataset, however I have access to the database and can read all the credentials from there directly.

Since it is a test environment, all users have the same password, so I can hardcode it, but I need the list of usernames. JMeter can already do JDBC requests, but I was wondering if there was any way to use the results from such a request as a dataset.

The ideal way would be for me to query the database for the usernames and use those as input for the login test.

Does anyone know if this is possible?

like image 914
Ive Avatar asked Oct 20 '22 07:10

Ive


1 Answers

Sure, it is possible.

  1. Follow the steps from The Real Secret to Building a Database Test Plan With JMeter to establish JDBC Connection and execute your query.
  2. Define a variable in the "Variable Name" input of the JDBC Request sampler

Variable Name 3. Query results will be available in form of

actor_1=John
actor_2=Doe
etc.

Results

If you need to deal with several columns, the approach is the same. See official documentation on JDBC Request Sampler for example

like image 182
Dmitri T Avatar answered Oct 21 '22 23:10

Dmitri T