Use database table as CSV dataset for JMeter

删除回忆录丶 提交于 2019-12-22 09:41:15

问题


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?


回答1:


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

3. Query results will be available in form of
actor_1=John
actor_2=Doe
etc.

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



来源:https://stackoverflow.com/questions/31264820/use-database-table-as-csv-dataset-for-jmeter

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!