You might have faced issues in writing data to excel/csv in JMeter. In this blog post, we will see How to write data to Excel/CSV in Jmeter using BeanShell scripting? By using Regular Expression Extractor, you can extract data from the response. To write extracted data to excel/csv in Jmeter, you need to use BeanShell PostProcessor sampler.
How to extract data from the response?
You can refer my slideshare presentation on how to extract data from the response.
refnum = vars.get("Reference_Number"); log.info(refnum); // if you want to log something to jmeter.log file // Pass true if you want to append to existing file // If you want to overwrite, then don't pass the second argument f = new FileOutputStream("yourpath/result.csv", true); p = new PrintStream(f); this.interpreter.setOut(p); print("Reference Number is," + refnum); f.close();
[auto_thumb width=”150″ height=”150″ link=”” lightbox=”true” align=”center” title=”How to write data to Excel CSV in Jmeter using BeanShell scripting – BeanShell PostProcessor Sample Code” alt=”How to write data to Excel CSV in Jmeter using BeanShell scripting – BeanShell PostProcessor Sample Code” iframe=”false” frame=”true” crop=”true”]http://qainsights.com/wp-content/uploads/2013/09/How-to-write-data-to-Excel-CSV-in-Jmeter-using-BeanShell-scripting-BeanShell-PostProcessor-Sample-Code.jpg[/auto_thumb]
Thanks for visiting QAInsights! Check out our new portal Testifications.com to get updates on Software Testing related certifications. We’re always posting interesting articles on QAInsights. I request you to subscribe so you don’t miss out anything.
Searching for QA Jobs Openings, check it at www.QAJobOpenings.com
Want to start a blog like this, please visit SpidyDomain to buy cheap web hosting and register domain.
- Speedometer 2.0 Testing - January 17, 2018
- Performance Analysis of Rajini Makkal Mandram Website - January 8, 2018
- Must Have Tools For Technical Founders - November 9, 2017
- Brotli Compression in Performance Testing - October 6, 2017
- Unboxing HPE StormRunner 2.7 - September 27, 2017