PradeepKumar February 2016
How to use Regular Expression extractor for output data of- 6002:6005:93974309c3f042a69b20c9f9c38a13e3
In my service response output is just like as below :
there is no other things come in output ,it returns above value ,I want write this values into one local file for all requests.
Dmitri T February 2016
Option 1: add the value to .jtl results file:
Add Regular Expression Extractor as a child of the request which returns this value and use the following Regular Expression Extractor configuration:
- Reference Name: anything meaningful, i.e.
- Regular Expression:
In user.properties file add the next line:
Upon next execution you will see an extra column in your results .jtl file containing values extracted from the response. See Sample Variables chapter of JMeter's User Manual for more information.
Option 2: writing variables into a separate file
- Instead of the Regular Expression Extractor add Beanshell PostProcessor as a child of the request which returns that value.
Put the following code into the PostProcessor's "Script" area:
FileUtils.writeStringToFile(new File("/path/to/your/file.txt"),new String(data) + System.getProperty("line.separator"), true);
The above code uses FileUtils.writeStringToFile() method to store the whole response into an arbitrary file. See How to Use BeanShell: JMeter's Favorite Built-in Component article for more information on using Java and JMeter API from Beanshell test elements in your JMeter test.
N.B. if you plan to produce high load go for option 1.
Asked in February 2016
Viewed 3,406 times
Answered 1 times
Leave an answer
Quote of the day: live life