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、在線程組頁面設置用戶數、啓動時間、循環次數
點擊菜單欄“運行”----“啓動”
運行結果: