The data I have as such:(this is extracted from some get api respsonse)
id1:{abc,qwe,ert,yup,iop,bnm,dff} and so on
id2 :{qwe,ert,iop,bnm,dff}
I want to find the missing elements between them So as suggested I have used JSR223 assertion and the groovy code is as follows:
log.info('id1: '+vars.get('id1_ALL'))
log.info('id1: '+vars.get('id2_ALL'))
def id1 = org.apache.commons.lang.StringUtils.substringBetween(vars.get('id1_ALL'), '{', '}').split(',').collect()
def id2 = org.apache.commons.lang.StringUtils.substringBetween(vars.get('id2_ALL'), '{', '}').split(',').collect()
def missing = org.apache.commons.collections.CollectionUtils.disjunction(id1, id2)
log.info('Missing values: ' +missing)
When I run the script I got "javax.script.ScriptException: groovy.lang.MissingPropertyException: No such property: org for class: Script1" error in view result tree
AND
In log viwer panel I can see the id1 and id2 contents but missing values isn't shown got this error
ERROR o.a.j.a.JSR223Assertion: Problem in JSR223 script: JSR223 Assertion javax.script.ScriptException: groovy.lang.MissingPropertyException: No such property: org for class: Script1 at org.codehaus.groovy.jsr223.GroovyScriptEngineImpl.eval(GroovyScriptEngineImpl.java:320) ~[groovy-jsr223-3.0.7.jar:3.0.7] at org.codehaus.groovy.jsr223.GroovyCompiledScript.eval(GroovyCompiledScript.java:71) ~[groovy-jsr223-3.0.7.jar:3.0.7] at javax.script.CompiledScript.eval(Unknown Source) ~[?:1.8.0_321] at org.apache.jmeter.util.JSR223TestElement.processFileOrScript(JSR223TestElement.java:217) ~[ApacheJMeter_core.jar:5.4.3] at org.apache.jmeter.assertions.JSR223Assertion.getResult(JSR223Assertion.java:50) [ApacheJMeter_components.jar:5.4.3] at org.apache.jmeter.threads.JMeterThread.processAssertion(JMeterThread.java:931) [ApacheJMeter_core.jar:5.4.3]
Can anyone help on how to resolve this error
1条答案
按热度按时间watbbzwu1#
我无法重现您的问题:
因此,请确保您准确地复制粘贴了以下代码,并且任何地方都没有丢失或多余的符号:
更多信息: