From the Previous request Groovy Script properly saving the data into the csv file, but passing the empty value in the following request.
Not sure exactly what went wrong. Tried hardcoded the Value and the request is fine.
https://xx.xx.xx.xxx/xx/projects/2228/week-endings/${__groovy(new%20File('${DH-week-endings}').readLines().get(${counter_value}),)}/departments/${id}/timecards
And here is error from the log
2022-01-11 12:56:55,519 INFO o.a.j.s.SampleEvent: List of sample_variables: []
2022-01-11 12:56:55,549 WARN o.a.j.f.Groovy: Error running groovy script
javax.script.ScriptException: javax.script.ScriptException: groovy.lang.MissingMethodException: No signature of method: org.codehaus.groovy.jsr223.GroovyScriptEngineImpl.$() is applicable for argument types: (Script66$_run_closure1) values: [Script66$_run_closure1@61d664cd]
Possible solutions: is(java.lang.Object), any(), get(java.lang.String), use([Ljava.lang.Object;), tap(groovy.lang.Closure), any(groovy.lang.Closure)
at org.codehaus.groovy.jsr223.GroovyScriptEngineImpl.eval(GroovyScriptEngineImpl.java:158) ~[groovy-jsr223-3.0.7.jar:3.0.7]
at javax.script.AbstractScriptEngine.eval(Unknown Source) ~[?:1.8.0_311]
at org.apache.jmeter.functions.Groovy.execute(Groovy.java:120) [ApacheJMeter_functions.jar:5.4.3]
at org.apache.jmeter.engine.util.CompoundVariable.execute(CompoundVariable.java:138) [ApacheJMeter_core.jar:5.4.3]
at org.apache.jmeter.engine.util.CompoundVariable.execute(CompoundVariable.java:113) [ApacheJMeter_core.jar:5.4.3]
at org.apache.jmeter.testelement.property.FunctionProperty.getStringValue(FunctionProperty.java:91) [ApacheJMeter_core.jar:5.4.3]
at org.apache.jmeter.testbeans.TestBeanHelper.unwrapProperty(TestBeanHelper.java:129) [ApacheJMeter_core.jar:5.4.3]
at org.apache.jmeter.testbeans.TestBeanHelper.prepare(TestBeanHelper.java:84) [ApacheJMeter_core.jar:5.4.3]
at org.apache.jmeter.engine.StandardJMeterEngine.notifyTestListenersOfStart(StandardJMeterEngine.java:202) [ApacheJMeter_core.jar:5.4.3]
at org.apache.jmeter.engine.StandardJMeterEngine.run(StandardJMeterEngine.java:382) [ApacheJMeter_core.jar:5.4.3]
at java.lang.Thread.run(Unknown Source) [?:1.8.0_311]
Caused by: javax.script.ScriptException: groovy.lang.MissingMethodException: No signature of method: org.codehaus.groovy.jsr223.GroovyScriptEngineImpl.$() is applicable for argument types: (Script66$_run_closure1) values: [Script66$_run_closure1@61d664cd]
Possible solutions: is(java.lang.Object), any(), get(java.lang.String), use([Ljava.lang.Object;), tap(groovy.lang.Closure), any(groovy.lang.Closure)
at org.codehaus.groovy.jsr223.GroovyScriptEngineImpl.eval(GroovyScriptEngineImpl.java:320) ~[groovy-jsr223-3.0.7.jar:3.0.7]
at org.codehaus.groovy.jsr223.GroovyScriptEngineImpl.eval(GroovyScriptEngineImpl.java:155) ~[groovy-jsr223-3.0.7.jar:3.0.7]
... 10 more
I believe correct syntax would be something like:
${__groovy(new File(vars.get('DH-week-endings')).readLines().get(vars.get('counter_value') as int),)}
vars
shorthand for JMeterVariables class instance instead