JMeter assertion failed to extract parameters in Request Body

tags: Jmeter  software test  

A problem that has been plagued for a long time, I haven't found the relevant answer, share it.

For example, a scene:

POST request, import DATA using CSV parameterization, when responding to assertion,Output and save the parameter value of the request(Post Data in Request Body).


Some people see this will say: You don't have more this, eat something and spit it out.

Yes, it is better than I want to eat a date. Put it in your mouth and chew it, find it broken, spit it out, I want to see which.

So, it's not more, because this is a demand, the demand is reasonable :-)

In JMeter, there is no processor such as a regular extractor to directly extract the POST DATA method.

Therefore, you can only add a beanshell assertion, write extraction and processing methods yourself.

There are two ways to take the POST DATA:

1.prev.getsamplerdata () // Get all request body data
2.Prev.QueryString // Get only Post Data

The DATA here has been encoded by the URL (when the parameter is encoded), then the acquired POST DATA is intercepted, using the URLDECoder decoding.

Method: Urldecoder.Decode ()

If the incubation is Chinese, remember to specify the format "UTF-8", otherwise it will be garbled after decoding.

Here is something to pay attention to:

The $ {__ urldecode ()} in the function assistant is invalid in Beanshell because it is only valid for constants, and the variable is invalid.

E.g:
DATA is a variable, $ {__ urldecode (data)} decoded is invalid;
$ {__ urldecode ("data")} outputs the string DATA directly;
In the input constant, it is effective: $ {__ urldecode ("% IT% E6% 96% 87% E8% 89% BA% E9% 9D% 92% E5% B9% B4")} will decode the output correctly;

Finally, the extracted error will be saved to the specified location file:

Intelligent Recommendation

JMeter adds HTTP request response to assertion

First, why should I add a response to the HTTP? After the HTTP request response is successful, Response Header responds to CODE = 200 can only explain the success of the server response and cannot pro...

Jmeter random request parameters

In some business scenarios, you need to randomly obtain the query results from upstream query interfaces to submit the preservation interface for downstream; Take a business scenario, there is a menu ...

FastApi --- Request Body - Multiple Parameters

content 1, mix using Path, Query and request body parameters 2, multiple request body parameters 3, a single value in the request body 4, multiple request body parameters and query parameters 5, embed...

MFCBUG encounters inappropriate parameters or debug assertion failed

The problem is as shown: as well as Why does this have such a problem: It is definitely a problem with the parameters you have incorporated, check the parameters of the calling place, and the folder o...

The difference between Parameters and Body Data in jmeter

Parameters The parameter in xx=xx&xxx=xx format is the value of the parameter in the url in the GET or POST request, such as: In one such request/api/v1/courseware/list?index=0&pagesize=100&am...

More Recommendation

Jmeter parameterization--Post request parameterization of Post body

1. Use body data to set parameters: 1. First, use Fiddler to record the post request, and send it successfully, import it into jmx format, and open it with jmeter; 2. At this time, without setting par...

Jmeter post request body missing problem

When using jmeter to debug the script, the interface keeps reporting the error message of interface request failure. Using jmeter to capture the packet, it turns out that the request body information ...

[jmeter--extract parameters and save to local csv]

(1) Extract the user lqtoken that needs to be saved in the information header (2) Add a BeanShell post-processing program to read the relevant variable parameters extracted by the extractor into the l...

ElateSearch (6) ---- Request parameters with request body

I. Grammar format Get index / _search { “command”:{ “parameter_name” : “parameter_value”} } 1. Query all data 2. Conditional Search (Spreading the conditions) 3. Ph...

The type of scg assertion and POST request multiple processing body resolution version

One, version sc version: Greenwich.RELEASE Corresponding scg version: spring-cloud-starter-gateway:2.1.0.RELEASE 2. Assertion type Among them, ReadBodyPredicatechaFactory also implements RoutePredicat...

Copyright  DMCA © 2018-2026 - All Rights Reserved - www.programmersought.com  User Notice

Top