使用数据库表作为 JMeter 的 CSV 数据集 [英] Use database table as CSV dataset for JMeter

查看:46
本文介绍了使用数据库表作为 JMeter 的 CSV 数据集的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我目前正在使用 JMeter 对我公司的一个应用程序进行性能测试.该应用程序需要登录,我必须使用多个用户.通常在 JMeter 中完成的方式似乎是通过 CSV 数据集,但是我可以访问数据库并且可以直接从那里读取所有凭据.

由于是测试环境,所有用户的密码都是一样的,所以我可以硬编码,但是我需要用户名列表.JMeter 已经可以做 JDBC 请求了,但是我想知道有没有什么办法可以把这样一个请求的结果作为数据集来使用.

对我来说,理想的方式是查询数据库中的用户名并将其用作登录测试的输入.

有人知道这是否可能吗?

解决方案

当然,这是可能的.

  1. 按照

    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?

    解决方案

    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

    这篇关于使用数据库表作为 JMeter 的 CSV 数据集的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆