top of page

Creating Custom Metrics in Performator

  • Writer: Josef Mayrhofer
    Josef Mayrhofer
  • 5 hours ago
  • 2 min read

Measuring what you need to measure and having the flexibility to enhance a report with additional data are vital tools for creating test reports that contain the information needed for a proper evaluation of a test execution.


Many tools either do not allow you to add custom metrics or data, or it is rather arduous to do so.


Performator is built so that the interface of its Hierarchical Statistics Engine (HSR) is open for the tester to use and register their own metrics.


Let’s have a look at some of the various metrics you can report.


Step


Using the following start() and end() methods, you can create a step metric that measures the execution time of what is executed in between:

//-------------------------------
// Step
HSR.start("010_MyMetricName");
	//Code to measure
HSR.end();

Group


How you can create a group:

//-------------------------------
// Group
HSR.startGroup("017_MyGroup");
	HSR.start("020_Execute_Search");
		//Code to measure
	HSR.end();
	// [...] other steps
HSR.end();

Messages


You can add messages by using the methods HSR.add*Message(String):

//-------------------------------
// Add Message
HSR.addInfoMessage("The train will leave at 4:16 PM.");
HSR.addWarnMessage("The train is delayed.");
HSR.addErrorMessage("The train has been cancelled.");

Counts


Counts are for reporting values that represent an overall count. Counts will be summed up in aggregation.

//-------------------------------
// Count
// will be summed up in aggregation 
HSR.addCount("070.2 Count: TiramisusEaten", HSR.Random.bigDecimal(0, 100));

Metric


Metrics are used to report values with statistical values like min, avg, max, etc. Metrics will calculate statistical values on aggregation.

//-------------------------------
// Metric
// will calculate statistical values 
HSR.addMetric("070.3 Metric: TimeWalked", HSR.Random.bigDecimal(100, 300));

Conclusion


Performator allows testers to add additional information to the report with one or two lines of code. This helps collect the information necessary to evaluate whether a test was successful while reducing the time spent gathering data from third-party monitoring tools and similar sources.


If you would like to learn more about Performator or encounter any issues while creating custom metrics, feel free to reach out to Performetriks. Our team is happy to help answer questions and provide guidance.

Happy Performance Engineering!






Comments


bottom of page