0

As I understand, JMeter recommends to use groovy, it's faster and more flexible, etc. I'm trying to add code to groovy JSR223, changing deprecated ctx.setRestartNextLoop(true); to setTestLogicalAction as per https://jmeter.apache.org/api/org/apache/jmeter/threads/JMeterContext.html

However, after much try-and-error I recongnized code from https://stackoverflow.com/questions/53371798/restarting-a-user-thread-conditionally-in-jmeter works fine in Beanshell, but gives errors such as:

"`ERROR o.a.j.p.j.s.JSR223Sampler: Problem in JSR223 script JSR223 Sampler, message: javax.script.ScriptException: groovy.lang.MissingMethodException: No signature of method: static org.apache.jmeter.samplers.SampleResult.setTestLogicalAction() is applicable for argument types: (org.apache.jmeter.threads.JMeterContext$TestLogicalAction) values: [START_NEXT_ITERATION_OF_THREAD]
Possible solutions: setTestLogicalAction(org.apache.jmeter.threads.JMeterContext$TestLogicalAction), getTestLogicalAction()
javax.script.ScriptException: groovy.lang.MissingMethodException: No signature of method: static org.apache.jmeter.samplers.SampleResult.setTestLogicalAction() is applicable for argument types: (org.apache.jmeter.threads.JMeterContext$TestLogicalAction) values: [START_NEXT_ITERATION_OF_THREAD]
Possible solutions: setTestLogicalAction(org.apache.jmeter.threads.JMeterContext$TestLogicalAction), getTestLogicalAction()
"  

when run in JSR223 groovy.

Can setTestLogicalAction be run in JSR groovy and if yes, then how?

ADDED: changing

SampleResult.setTestLogicalAction(TestLogicalAction.START_NEXT_ITERATION_OF_THREAD);

to
ctx.setTestLogicalAction(TestLogicalAction.START_NEXT_ITERATION_OF_THREAD);

removed the error, but thread is not restarted.

P.S. by the way, I've tried STWF about dollar sign in java classes, found it's appears in files names for inner classes. So org.apache.jmeter.threads.JMeterContext$TestLogicalAction means there is a package org.apache.jmeter.threads with outer JMeterContext and inner TestLogicalAction? How multiple levels inner would be called, like org.foocorp.foo$name1$method1$etc?

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Browse other questions tagged or ask your own question.