我正在从此json中提取$ .matching_results:
{
"matching_results": 5,
"enrichments": {
"keywords": [
{
"text": "shore of Mobile Bay",
"relevance": 0.809978
}
],
"concepts": [
{
"text": "Mobile, Alabama",
"relevance": 0.972324
},
{
"text": "Birmingham, Alabama",
"relevance": 0.954301
}
]
},
"session_token": "1_e7R7s9QIt28pN8p3_TzjR8acCX"
}
,我想将其与两个变量的乘积进行比较
${__BeanShell(${__evalVar(numAssetThreads)}*${__evalVar(numAssetLoops)})}
我尝试了上面的表达式和这个表达式
${__BeanShell(String.valueOf(${__evalVar(numAssetThreads)}*${__evalVar(numAssetLoops)}))}
并且我尝试了在没有指定Match as a regular expression
的情况下进行的尝试。
我也尝试过
${__BeanShell(${__V(numAssetThreads)}*${__V(numAssetLoops)})}
在所有情况下,我都会收到类似以下错误消息:
Assertion failure: true
Assertion failure message: Value expected to match regexp '5 ', but it did not match: '5'
或
Assertion error: false
Assertion failure: true
Assertion failure message: Value expected to be '2 ', but found '2'
如何使它正常工作?
答案 0 :(得分:0)
Value expected to match regexp '5 ', but it did not match: '5'
there is a space after 5 here --^
以某种方式删除此空间,您的断言应该开始起作用。
请注意,自JMeter 3.1起,您应该考虑以以下方式迁移到__groovy() function: