预期值和实际值做对比
步骤:
1、得到表格数据
2、接口断言预期值与实际值做对比
读取表格数据-得到接口地址(address)和是否接口db检查(dbcheck),并且这条数据是有效的(vaild)
有2条用例,也会有三个条件不全部满足的情况,也会有登录失败的case
所以在判断时,会有有效用例和无效用例判断
sql执行count为1是有效的,为0是无效的

继续写实际值与预期值对比
返回值包含1,否则就是无效

最终代码

优化
登录接口-请求值分割(方法正则表达式)

把代码合并
优化
因为限制了判断条件,需要先登录才能去判断,所以在预期值和实际值对比时,就不需要验证无效条件
最终优化把temp1优化掉
测试增加sout打印效果

测试
在testrun里增加临时代码测试,需要将之前html和json断言的请求屏蔽,只看数据库断言


最终优化代码
测试
