How to write HTML response in a file using JMeter

Divakar Ragupathy

Can any one help me how to save HTML response (including screen images) from View Results Tree listener using JMeter?

I can store the results in csv but my main objective is to store the screen images that are displayed in view results tree

The screenshot name should be stored under step name (eg: TC002 Account Menu)

enter image description here

Sergey Gornostaev

You can add JSR223PostProcessor and save response body to the file. For example like this:

    File file = new File(pathToYourFile);
    FileWriter fstream= new FileWriter(file,true);
    BufferedWriter out = new BufferedWriter(fstream);
    out.write(prev.getResponseDataAsString());
    out.close();
    fstream.close();

If you want each answer to be saved in a different file, you will need to add code to create the files and add them a new uniq name.

UPD One way to save each response in your own file is to generate the name depending on the value of the counter like this: (Using JMeter Functions)

    def filename = "${__counter(FALSE,)}" + "response.html";
    File file = new File("C://JmeterResultFolder//"+filename);

or this: (Using Counter Sampler)

enter image description here

def filename = "${counter}" + "response.html";
File file = new File("C://JmeterResultFolder//"+filename);

and in the end you will get file for each request enter image description here

Collected from the Internet

Please contact [email protected] to delete if infringement.

edited at
0

Comments

0 comments
Login to comment

Related

From Dev

How to write data into a JSON file using jquery

From Dev

How to write a zip file using Haskell LibZip?

From Dev

How do I input text via an HTML form and retrieve data from a JSON file as a response using Javascript?

From Dev

How to write the "greater than symbol" in a HTML file using a batch file

From Dev

NodeJS: How to write a file parser using readStream?

From Dev

response.write writes after html closing tag, how to instead replace a string from the response inside html?

From Dev

How to write unicode value to a file using java?

From Dev

How to write html file with a text editor

From Dev

How to write HTML tags in Perl using LibXML

From Dev

How to write Jmeter Regex into a file after extraction

From Dev

How to write lists as a file attribute using PyGTK

From Dev

How to edit response in jmeter

From Dev

How write 'Ñ' in a file using python

From Dev

Headless JMeter -How to get printed the response data in the output file

From Dev

How to Write to a file using StreamWriter?

From Dev

How can i use the data gotten from a json response in another html file using angular js

From Dev

how to format JSON response in Jmeter?

From Dev

How do I write my html table to excel file using epplus

From Dev

How to write html to a file in android

From Dev

response.write writes after html closing tag, how to instead replace a string from the response inside html?

From Dev

jmeter regex extractor for response header in html

From Dev

redirecting a html form using response.write in kentico not working

From Dev

JMeter - Using response data as variable

From Dev

How to write to a file using an FPGA

From Dev

how to save a xml list from response to a csv file in JMeter

From Dev

How to write web-service response to file using camel?

From Dev

How to extract the response using a regular expression for Jmeter?

From Dev

Write request and response data to file in jmeter

From Dev

How to write a Python for loop in an HTML file?

Related Related

  1. 1

    How to write data into a JSON file using jquery

  2. 2

    How to write a zip file using Haskell LibZip?

  3. 3

    How do I input text via an HTML form and retrieve data from a JSON file as a response using Javascript?

  4. 4

    How to write the "greater than symbol" in a HTML file using a batch file

  5. 5

    NodeJS: How to write a file parser using readStream?

  6. 6

    response.write writes after html closing tag, how to instead replace a string from the response inside html?

  7. 7

    How to write unicode value to a file using java?

  8. 8

    How to write html file with a text editor

  9. 9

    How to write HTML tags in Perl using LibXML

  10. 10

    How to write Jmeter Regex into a file after extraction

  11. 11

    How to write lists as a file attribute using PyGTK

  12. 12

    How to edit response in jmeter

  13. 13

    How write 'Ñ' in a file using python

  14. 14

    Headless JMeter -How to get printed the response data in the output file

  15. 15

    How to Write to a file using StreamWriter?

  16. 16

    How can i use the data gotten from a json response in another html file using angular js

  17. 17

    how to format JSON response in Jmeter?

  18. 18

    How do I write my html table to excel file using epplus

  19. 19

    How to write html to a file in android

  20. 20

    response.write writes after html closing tag, how to instead replace a string from the response inside html?

  21. 21

    jmeter regex extractor for response header in html

  22. 22

    redirecting a html form using response.write in kentico not working

  23. 23

    JMeter - Using response data as variable

  24. 24

    How to write to a file using an FPGA

  25. 25

    how to save a xml list from response to a csv file in JMeter

  26. 26

    How to write web-service response to file using camel?

  27. 27

    How to extract the response using a regular expression for Jmeter?

  28. 28

    Write request and response data to file in jmeter

  29. 29

    How to write a Python for loop in an HTML file?

HotTag

Archive