1

There is an answer how to generate JMeter report: How do I generate a Dashboard Report in jmeter?

And there is a question w/out accepted answer Solution to save Jmeter Dashboard reports to Confluence.

Although ultimately I now need to put info in Confluence, I want at least to be able to copy charts/graphs one by one, but although in both Chrome and Firefox I do have context menu of saving a picture ('Save image'), however resulting image looks empty in both of browsers. How can I save chart from HTML report to image?

Below is start of hexdump of one png file (they all come 32Kb size).

0000000 211   P   N   G  \r  \n 032  \n  \0  \0  \0  \r   I   H   D   R
0000010  \0  \0  \b 213  \0  \0 003      \b 006  \0  \0  \0   ?   ?   p
0000020  \n  \0  \0      \0   I   D   A   T   x   ^   ?   ?   A 001  \0
0000030  \0  \b 002   1   ?   _   ?       7 033   0   |   ?   s 004  \b
0000040 020       @ 200  \0 001 002 004  \b 020       @ 200  \0 001 002
0000050 004  \b 020       @ 200  \0 001 002 004  \b 020       @ 200  \0
0000060 001 002 031 201   e 222  \n   J 200  \0 001 002 004  \b 020    
0000070   @ 200  \0 001 002 004  \b 020       @ 200  \0 001 002 004  \b
0000080 020       @ 200  \0 001 002 004  \b 020       p   ?   " 236 200
0000090  \0 001 002 004  \b 020       @ 200  \0 001 002 004  \b 020 
Ori Marko
  • 56,308
  • 23
  • 131
  • 233
Alex Martian
  • 3,423
  • 7
  • 36
  • 71

2 Answers2

2

The charts are not normal <img> they reside in <canvas> tag

enter image description here

if you really want to proceed this way you could locate the canvas element you want to save and invoke toDataUrl() function on it like:

document.getElementById('responseTimesOverTime').getElementsByTagName('canvas')[0].toDataURL()

enter image description here

Once done you will get so called Data URL in form of data:image/png;base64,............... text as the output.

If you put this text into your browser URL area the image will open:

enter image description here

And this will be "real" image which can be saved.

An easier option would be using service like BM.Sense which can generate PDF reports out of the .jtl results files which can be added to the Confluence via the PDF Macro

Dmitri T
  • 159,985
  • 5
  • 83
  • 133
1

You can use JMeterPluginsCMD to produce a image from report

There is small command-line utility for generating graphs out of JTL files. It behave just like right-click context menu on all graphs. The tool can generate PNG

Generating PNG:

JMeterPluginsCMD.bat --generate-png test.png --input-jtl results.jtl --plugin-type ResponseTimesOverTime --width 800 --height 600

In order to generate graphs using that plugin you most probably need also to install jpgc - Standard Set plugin and graph-s plugins (in plugins manager in JMeter on available page search for graph and install what suits needed charts description).

Parameter --plugin-type to choose graph type may not always be made of same wording as graphs names in HTLM report, see list of parameters on JMeterPluginsCMD page along with list of parameters to customise looks of graphs.

Community
  • 1
  • 1
Ori Marko
  • 56,308
  • 23
  • 131
  • 233
  • It need as input name of each graph? if so I can of cause write command file with several invocations... – Alex Martian Oct 29 '19 at 09:01
  • I now got error: `Exception in thread "main" java.lang.RuntimeException: java.lang.ClassNotFoundException: kg.apc.jmeter.vizualizers.ResponseTimesOverTimeGui` caused by `kg.apc.jmeter.PluginsCMDWorker.getGUIObject(PluginsCMDWorker.java:227)` – Alex Martian Oct 29 '19 at 09:14
  • 1
    @AlexeiMartianov Missing plugin see http://www.jmeter-archive.org/The-error-when-executing-JMeterPluginsCMD-Command-Line-Tool-td5725056.html – Ori Marko Oct 29 '19 at 09:17
  • @AlexeiMartianov can you ask a new question with more details of versions and exception? – Ori Marko Nov 01 '19 at 09:37