【发布时间】:2018-07-19 17:41:11
【问题描述】:
如果有人可以帮助我解决此错误,我非常感谢,我尝试在我的一个测试用例的两个测试步骤中比较 Json 响应。 第一步添加一个任务,第二步获取所有任务的列表。 从第一步开始,我在 Json 文件中的所有内容都是一个数字,它是最后添加的任务的 TaskId。我需要在第二个测试步骤 Json 响应中检查该 taskid 是否存在? 我的 Groovy 断言是:
import groovy.json.JsonSlurper
def Response1 = context.expand( '${#ApiSmartsTaskPhysicalsPost - add an
Unplanned task#Response}' );
def JSON1 = new JsonSlurper().parseText Response1;
log.info JSON1
def Response2 = context.expand( '${#ApiSmartsTaskPhysicalsGet -Check if
values have been updated#Response}' );
def JSON2 = new JsonSlurper().parseText Response2;
log.info JSON2
assert JSON1 == JSON2
但我收到此错误:
" java.lang.illegalargumentexception:文本不能为空,错误在 行:3“
有没有机会指导我解决这个问题?检查端点是否相同,网址是否正确。
【问题讨论】:
标签: json groovy automated-tests soapui assertion