老师你好,我用soapui做测试,添加断言判断:这个id是通过post方法传进来的,现在通过get方法,判断传递的参数id跟get的id值一样。
def root = net.sf.json.JSONSerializer.toJSON(messageExchange.responseContent)
log.info root.get("id")
assert root.id.equals(context.expand('${Properties1#id}'))
log.info context.expand('${Properties1#id}') 运行报错:assertroot.id.equals(context.expand('${Properties1#id}')) | | | | | | 53 false | 53 |[ThreadIndex:0, RunCount:0] net.sf.json.JSONObject@5d98453d (toString() threwgroovy.lang.GroovyRuntimeException 但是单独运行:
def root = net.sf.json.JSONSerializer.toJSON(messageExchange.responseContent)
log.info root.get("id")
log.info context.expand('${Properties1#id}') 结果是pass的,出来的id是一样的。怎么就是加了assert那句话就不对了呢? 部分response json数据: {
"id": 53,
"defaultRoleId": 1,
"loginId": "test55",
"password":"8F0E2F76E22B43E2855189877E7DC1E1E7D98C226C95DB247CD1D547928334A9",
"name": "user name",
"email": "xxx@xxx.com",
"phone": "123456789",
"repository": "DB",
"deleted": "N",
"departmentList": [ {
在学课程
SoapUI让你轻松玩转WebService接口测试
http://www.atstudy.com/course/528
|