Beanshell处理Json返回值并断言

it2023-02-09  47

import com.alibaba.fastjson.JSONObject; import com.alibaba.fastjson.JSON; String rep = prev.getResponseDataAsString(); log.info(rep); JSONObject jsonobj = JSON.parseObject(rep); String message = jsonobj.getString("success"); log.info("message的值:" + message); if("tru1".equals(message)==true){ Failure=false; FailureMessage="接口正确"; }else{ Failure=true; FailureMessage="接口有误"; }
最新回复(0)