venturieffect
venturieffect

Reputation: 191

JMeter JSR233 result to dashboard

I have a JMeter test that insert an input via an HTTP call to an asynchronous java-service and then collects an exposed metric on another java-service via a groovy script.

The script then saves the collected metric as a JMeter variable to be reviewed as a performance metric.

I would like to publish this value inside the JMeter -generated dashboard but I can't find a way to save this variable as a JMeter output.

Is there a way? seems JMeter is primarily aimed to test HTTP synchronous services but it's capable of doing such collection of data.

Upvotes: 2

Views: 592

Answers (2)

Dmitri T
Dmitri T

Reputation: 168002

Declare the JMeter Variable you're saving in the JSR223 script as a Sample Variable, in order to do this add the next line to user.properties file:

sample_variables=foo

Then you can configure your custom chart like:

jmeter.reportgenerator.graph.custom_testGraph.classname=org.apache.jmeter.report.processor.graph.impl.CustomGraphConsumer
jmeter.reportgenerator.graph.custom_testGraph.title=Your custom chart title
jmeter.reportgenerator.graph.custom_testGraph.property.set_Y_Axis=Your Y axis name
jmeter.reportgenerator.graph.custom_testGraph.set_X_Axis=Over Time
jmeter.reportgenerator.graph.custom_testGraph.property.set_granularity=60000
jmeter.reportgenerator.graph.custom_testGraph.property.set_Sample_Variable_Name=foo
jmeter.reportgenerator.graph.custom_testGraph.property.set_Content_Message=Your custom content message

replace foo with the actual JMeter Variable name of your choice and next time you generate HTML reporting dashboard you should see your variable values plotted over time

More information:

Upvotes: 1

Ori Marko
Ori Marko

Reputation: 58774

You can use variable(s) in custom graph definitions:

You can graph any sample_variable in CSV over time, you can customize your graphs by settings their properties in the user.properties file. They must use the id prefix custom_:

jmeter.reportgenerator.graph.custom_<your_graph_name_id>.property.<your_option_name>

To specify that this graph is a customized one :

jmeter.reportgenerator.graph.custom_<your_graph_name_id>.classname=org.apache.jmeter.report.processor.graph.impl.CustomGraphConsumer

Here is an example of a custom graph configuration that graphs the variable ts-hit:

jmeter.reportgenerator.graph.custom_testGraph.classname=org.apache.jmeter.report.processor.graph.impl.CustomGraphConsumer
jmeter.reportgenerator.graph.custom_testGraph.title=Chunk Hit
jmeter.reportgenerator.graph.custom_testGraph.property.set_Y_Axis=Number of Hits
jmeter.reportgenerator.graph.custom_testGraph.set_X_Axis=Over Time
jmeter.reportgenerator.graph.custom_testGraph.property.set_granularity=60000
jmeter.reportgenerator.graph.custom_testGraph.property.set_Sample_Variable_Name=ts-hit
jmeter.reportgenerator.graph.custom_testGraph.property.set_Content_Message=Number of Hits :

Upvotes: 1

Related Questions