How to get Sampler Body data from beanshell Pre-Processor - JMeter

GKalya

I have Http Sampler body as follows, {"Uname":"admin","Signature":"${Sign}","LoginTime":"${LogTime}","Action":"Do_Action"}

I have to get the value of "Action" from the above body, and that value nned to be sent to Pre-processor which will be useful to do further action.

Help me out of this...!!

Thanks!

Dmitri T

I would recommend switching to JSR223 PreProcessor and Groovy language as:

  1. Groovy has built-in JSON support
  2. Groovy performs much better than Beanshell

Example Groovy code to extract "Action" from the request body and store it into ${action} JMeter Variable will look like:

def body = new groovy.json.JsonSlurper().parseText(sampler.getArguments().getArgument(0).getValue())
vars.put('action', body.Action)

See Groovy is the New Black article for more details.

Collected from the Internet

Please contact [email protected] to delete if infringement.

edited at
0

Comments

0 comments
Login to comment

Related

jmeter beanshell pre processor

How to get value from property in BeanShell (jmeter)

How to modify HTTP request before sending in JMeter through Beanshell pre processor?

Jmeter beanshell Post Processor

Jmeter, BeanShell Sampler and Summary Report

Jmeter: Access all results from all threadGroups from JSR223 Sampler or BeanShell Sampler in TeardownThread

Error in Beanshell Sampler JMeter for parsing RegularExpressionExtractor

Parsing string to integer in BeanShell Sampler in JMeter

JMeter Beanshell sampler that runs when HTTP Request Sampler fails

How to get the thread and the sampler name in JMeter

In Jmeter how do I set a variable number of threads using a beanshell sampler variable?

Jmeter : Error when I try to get data from Database using beanshell assertion

How to pass Bean shell processor variable in to HTTP Request body data in jmeter

BeanShell Post Processor parse Json using Jmeter

If else statement in Jmeter Beanshell post-processor

How to run the same sampler in Jmeter until I get specific result in response data Json

How to make Jmeter run command from CMD - OS sampler - JMETER

Jmeter - How do I see sampler data following running a test from Command line?

JMeter: How to provide condition in Beanshell post processor just to log successful/failed signup

How can I print only 4 digits after decimal in Jmeter using Beanshell post processor?

Jmeter how can I use if controller to get the value of body data

Get first json object from response rest service by Beanshell in jmeter

JMeter - Exception when using Beanshell as JSR223 Sampler with file

Unable to append to next line in a file through beanshell assertion sampler in Jmeter

Store Jmeter sampler properties value using beanshell preprocessor

Writing Variables using Beanshell Sampler in JMeter into a txt/csv file

Get the downloaded file name from sampler response in JMeter

How to get Machine IP Address using beanshell in JMeter?

How to get the name given to transaction controller using beanshell preprocesssor in jmeter