肥皂UI Groovy Jonnull处理
您好,我是Soap UI中这个Groovy剧本的新手,有人可以告诉我我在做什么错吗?如果使用此代码为null条件,我无法执行
//Getting Request
def RequestMessage=context.request
log.info RequestMessage
def jsonSlurper = new JsonSlurper().parseText(RequestMessage)
try{
if(jsonSlurper.iso8583Request.iso8583Detail.bit127){
log.info "127 is null"
}else{
testRunner.testCase.setPropertyValue("revBit127", "${jsonSlurper.iso8583Request.iso8583Detail.bit127}")
}catch{
log.info "127 is null"
}
任何建议,如果此JSON对象的无效条件可以处理?
Hello I'm new to this Groovy Script thing in SOAP UI can anyone tell me what i'm doing wrong? i can't do a if null condition with this code
//Getting Request
def RequestMessage=context.request
log.info RequestMessage
def jsonSlurper = new JsonSlurper().parseText(RequestMessage)
try{
if(jsonSlurper.iso8583Request.iso8583Detail.bit127){
log.info "127 is null"
}else{
testRunner.testCase.setPropertyValue("revBit127", "${jsonSlurper.iso8583Request.iso8583Detail.bit127}")
}catch{
log.info "127 is null"
}
Any advice to handle if null condition from this Json object?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
你不远。
首先,我在使用JSON Slurper时不会链,我倾向于这样使用它...
在您的示例中,我认为这是错误的...
您实际上是在检查它,而是尝试...
You're not far off.
Firstly, I don't chain when using JSON Slurper, I tend to use it like this...
In your example, I think this is wrong...
You're actually checking it exists, instead try...