groovy 如何使用JMeter打印缺少的元素?

amrnrhlw  于 2022-11-01  发布在  其他
关注(0)|答案(1)|浏览(179)

{"header":{"type":"auto_translation","ret_code":"error","time_cost":2623.0,"request_id":"b3625eea599c11ed9ba95b34174e380d"},"message":"Translation error (20001), please retry later. Detail: RuntimeException - The length of source sentence is too long!!! - {\n "header": {\n "time_cost": 0.000356,\n "type": "auto_translation",\n "ret_code": "The length of source sentence is too long!!!"\n }\n}"}

zujrkrfu

zujrkrfu1#

1.我无法重现您的问题,可能是环境问题,这取决于您的Java版本和JMeter类路径中的库。
1.查看变量值,删除{}字符没有意义,因为它们不存在。
1.您可以尝试使用import语句,而不是指定完全限定的类名,例如,将“your”代码更改为如下形式:

import org.apache.commons.collections.CollectionUtils

log.info('id1: '+vars.get('id_ALL'))

log.info('id2: '+vars.get('c_id_ALL'))

def id1 = vars.get('id_ALL').split(',').collect()

def id2 =vars.get('c_id_ALL').split(',').collect()

def missing = CollectionUtils.disjunction(id1, id2)

log.info('Missing values: ' +missing)

演示:

更多信息:Scripting JMeter Assertions in Groovy - A Tutorial

相关问题