简体   繁体   中英

JMeter Getting Parameters From ResponseParameters To Generate New Request

I want to use Jmeter to test a website that uses Servlet+Struts+WebSphereCommerce Technology. I would like to be able to generate Request according to previous response.

I use View Results Tree after html request in order to inspect response of the previous call but i do not see the parameters (responseProperties) i set in response. instead i just see piece of .js code, html code or images.

how to gather response properties?

finally i would like to be able to use such properties to create the following request.

JMeter provides Beanshell scripting as extension mechanism so you can add a Beanshell Post Processor as a child to your HTTP Request and refer to response properties as follows:

String responseCode = prev.getResponseCode();
String responseHeaders = prev.getResponseHeaders();
String responseMessage = prev.getResponseMessage();
String responseData = prev.getResponseDataAsString();

Where prev is a shor-hand for previous SampleResult

If you want to use a part of response in next request (this is called "correlation") JMeter provides other Post Processors which can extract data from response and store it into JMeter Variables for later re-use such as:

etc.

Hope this helps.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM