Test Plan中引用jar包
jar包可以去网上下载对应的版本
JDBC Connection Configuration
1、添加配置元件JDBC Connection Configuration
2、配置数据库连接信息
①variable name:自己定义一个数据库的名字,在后面jdbc request中会用到
②database url:jdbc:mysql://主机名:端口号/数据库名字?allowMultiQueries=true
添加 ?allowMultiQueries=true 支持多条sql执行
③jdbcdriver class:选择mysql
④username:数据库用户名
⑤password:数据库密码
JDBC request
①variable name:填写jdbc connection configuration中定义好的名字
②query type:选择是select或者update等类型
③空白区域填写自己的sql语句即可
运行后可以查看到查询结果
将查询结果作为变量保存
variable names:定义变量名
①输入:variable1,查询结果第一列的结果会存在变量variable1中,使用该变量值时用${variable1_1}
②输入:,three,查询结果第三列的结果会存在变量three中