标签:mini database mamicode api info work 注意 res exec
1.下载 DatabaseLibrary 库
2.下载 pymysql 库(作为中间件)
3.工程中导入 DatabaseLibrary 库
4.数据测试常用关键字
Connect To Database pymysql study root 123456 192.168.1.110 3306 #连接study数据库 Table Must Exist student #判断student存在 Check If Exists In Database select * from student where name = "zhangsan" #判断查询结果数据存在 Check If Not Exists In Database select * from student where name = "zhengying" #判断查询结果数据不存在 Delete All Rows From Table student_copy #删除student_copy表中所有数据
Connect To Database pymysql study root 123456 192.168.1.110 3306 #连接study数据库 Execute Sql Script C:/Users/Administrator/Desktop/sql.txt #通过脚本文件进行执行sql(注意转义) Execute Sql String INSERT INTO student(name,age,class)VALUES("qian",23,3),("sun",20,1) #执行sql语句
Connect To Database pymysql study root 123456 192.168.1.110 3306 #连接study数据库 @{result} Query select * from student where name = "lisi" #查询数据且返回查询结果 Log Many ${result} #结果如下 20200312 15:20:10.798 : INFO : [(2, ‘lisi‘, 19, ‘3‘)]
Connect To Database pymysql study root 123456 192.168.1.110 3306 #连接study数据库 ${count} Row Count select * from student #返回查询结果的总行数 log ${count}
Connect To Database pymysql study root 123456 192.168.1.110 3306 #连接study数据库 Row Count Is 0 select * from student where name = "lisi" #判断查询结果为 0 行数据,如果结果为 0 行数据则 pass,否则fail
Connect To Database pymysql study root 123456 192.168.1.110 3306 #连接study数据库 Row Count Is Equal To X select * from student where name = "lisi" 1 #判断查询结果数据为1行 Row Count Is Greater Than X select * from student where class = "2" 1 #判断查询结果数据大于1行 Row Count Is Less Than X select * from student where class = "2" 3 #判断查询结果数据小于3行
标签:mini database mamicode api info work 注意 res exec
原文地址:https://www.cnblogs.com/ZhengYing0813/p/12469704.html