https://bz.apache.org/bugzilla/show_bug.cgi?id=63991
Bug ID: 63991
Summary: JSR223 Preprocessor does not work on loop controller
Product: JMeter
Version: 5.2.1
Hardware: Macintosh
Status: NEW
Severity: blocker
Priority: P2
Component: HTTP
Assignee: [email protected]
Reporter: [email protected]
Target Milestone: JMETER_5.2
I am having issue when using JSR223 preprocessor in loop controller. My
use-case is that i have to process 20,000 CSV rows and where each row would be
treated as request body to our backend API. In my use case JSR223 pre-processor
will remove empty parameter from request and then pass the clean JSON to the
API. Now the issue that i am facing is when i use JSR223 pre-processor on loop
controller then first request passes and second fails giving empty request.
However when i explicitly specify in thread-users let's say 100 threads (users)
out of 20,0000 then each of these 100 request will pass since it is using new
thread. For your reference my problem has also been posted on stack-overflow
but i haven't found any solution. I am pasting the links below -
https://stackoverflow.com/questions/59060041/how-do-i-remove-empty-parameter-using-beanshell-preprocessor-in-jmeter
https://stackoverflow.com/questions/59145444/how-do-i-iterate-through-csv-in-jmeter-creating-new-thread
Also someone else is also having similar issue so i know that i am not the only
one. Here is a link to that post -
https://stackoverflow.com/questions/59170591/jmeter-change-the-post-request-when-json-body-contain-branket-and-slash
For your reference the JSR223 pre-processor script that i am using is -
def request = new
groovy.json.JsonSlurper().parseText(sampler.getArguments().getArgument(0).getValue())
def newRequest = evaluate(request.inspect())
request.body.each { entry ->
if (entry.getValue().equals('')) {
newRequest.body.remove(entry.getKey())
}
}
sampler.getArguments().removeAllArguments()
sampler.addNonEncodedArgument('', new
groovy.json.JsonBuilder(newRequest).toPrettyString(), '')
Hopefully you guys get this resolved while using loop controller or infinite
loop.
sampler.setPostBodyRaw(true)
--
You are receiving this mail because:
You are the assignee for the bug.