JDBC驱动下载地址:https://dev.mysql.com/downloads/connector/j/
目的:查询数据库new_schema中表new_table 中name字段含字符‘y’的数据,见《MYSQL WORKBENCH创建数据库和表》
1、打开JMeter,点击测试计划,浏览添加JDBC驱动
2、添加一个线程组,右键点击“线程组”-“配置元件”,在下面添加一个“JDBC Connection Configuration”
JDBC Driver class在数据库驱动官网文档中查找http://dev.mysql.com/doc/connector-j/5.1/en/connector-j-reference-configuration-properties.html
"The name of the class that implements java.sql.Driver
in MySQL Connector/J iscom.mysql.jdbc.Driver
. Theorg.gjt.mm.mysql.Driver
class name is also usable for backward
compatibility with MM.MySQL, the predecessor of Connector/J. Use this class name when registering the driver, or when configuring a software to use MySQL Connector/J."
3、右键点击“线程组”,在下面添加一个“JDBC request”
4、右键点击线程组---->添加--->断言---->响应断言。断言内容‘y’
5、
添加一个断言结果:
右键点击线程组---->添加--->监听器---->结果断言。
添加一个图形结果:
右键点击线程组---->添加--->监听器---->图形结果。
添加一个查看结果树:
右键点击线程组---->添加--->监听器---->查看结果树。
6、在线程组页面设置用户数、启动时间、循环次数
点击菜单栏“运行”----“启动”
运行结果: