Anonymous
Anonymous

Reputation: 888

JMeter: How to capture overall response data using Regular Expression Extractor

I want to re-use the Response Data received in Listener as show in Image below.

I would like to know, how can I capture overall response so that I can re-use the same for uploading.

Scenario is:

  1. Download 1KB of string data using TCP Sampler (Port: XYZW)

  2. Upload the text response received (Port: ASDF)

enter image description here

Upvotes: 1

Views: 1450

Answers (3)

Dmitri T
Dmitri T

Reputation: 168157

As per How to Extract Data From Files With JMeter the relevant Regular Expression should be:

(?s)(^.*)

Entire configuration:

Regex for full response

Upvotes: 2

dtqtram
dtqtram

Reputation: 46

With Http sampler, I add a BeanShell PostProcessor as a child of Http sampler and use below script to retrieve all response data, I think it's the same with TCP sampler, let's try:

// get all response data
String dashboardData = prev.getResponseDataAsString();
// do something with the data
// and then put the retrieved data into parameter to use later
vars.put("dataTobeUsed", dashboardData);

and we can use ${dataTobeUsed} for other samplers

If you want to get the response data via regular expression extractor, you can use the pattern ([^"]+)

Hope it's helpful!

Upvotes: 1

Bhomik
Bhomik

Reputation: 73

Hope I understood your question right,

You can use regular exp [a-z0-9]* with any reference name lets say "TCP_Data" in your first TCP request. Now you can use the same reference name in TCP request 2, by ${TCP_Data}.

Upvotes: 0

Related Questions