JMETER:获取unicode响应

JMETER:获取unicode响应,jmeter,Jmeter,我的jmeter响应如下: {"result":"fail", "reason":"\u0027radius\u0027 should be greater than 0 and less than 90000"} 我想断言响应,但\u0027是一个垃圾值,我想在jmeter响应中丢弃这些值。我尝试更改jmeter.properties文件中的unicode值,但没有帮助。 提前感谢。\u0027不是“垃圾”,所以它可能是应用程序中的一个bug。此外,撇号不需要根据 因此,我建议再次检查

我的jmeter响应如下:

  {"result":"fail", "reason":"\u0027radius\u0027 should be greater than 0 and less than 90000"}
我想断言响应,但\u0027是一个垃圾值,我想在jmeter响应中丢弃这些值。我尝试更改jmeter.properties文件中的unicode值,但没有帮助。
提前感谢。

\u0027
不是“垃圾”,所以它可能是应用程序中的一个bug。此外,撇号不需要根据

因此,我建议再次检查需求

同时,您仍然可以“断言”响应,如
包含
匹配
模式将输入视为一种模式,因此模式不必精确匹配,它可以是正则表达式方面的“匹配”

最后,您可以使用和代码将这些unicode转义替换为撇号,如:

def unicode = new String(prev.getResponseData())
log.info('Unicode: ' + unicode) 
def normal = unicode.replaceAll('\\\\u0027','\'')
log.info('Normal: ' + normal)
prev.setResponseData(normal, 'UTF-8')
它将在响应中用
'
替换所有出现的
\u0027
,并用新值替换响应数据:


更多信息:

我使用jmeter-Dfile.encoding=UTF-8从命令行打开jmeter,在调试采样器中找到file.encoding=UTF-8,但响应仍然相同:“原因”:“\u0027radius\u0027应该大于0且小于90000”