Ask Your Question

Revision history [back]

click to hide/show revision 1
initial version

To make the text and background of a cell in a statistics table turn red in JMeter HTML Dashboard Report, if the response time exceeds the threshold value, follow these steps:

  1. Open your JMeter Test Plan.
  2. Add a Listener that generates the HTML Dashboard Report (like "Generate Dashboard Report").
  3. In the HTML Dashboard Report generation properties, set the threshold value for the response time metric.
  4. Choose the statistics table you want to customize and find the relevant HTML tag that corresponds to the cell that contains the statistic value you want to customize.
  5. Add an "if" condition to the HTML tag that checks whether the statistic value exceeds the threshold value.
  6. If the "if" condition evaluates to "true", add a class to the HTML tag that specifies the red text and background style.
  7. Save the modified HTML template and generate the Dashboard Report again.

Here is an example of the HTML template modification:

<td class="${stat.statErrorPct > ${threshold} ? 'failText' : ''}">
  ${stat.statErrorPct}
</td>

In this example, the "if" condition checks whether the "statErrorPct" statistic value exceeds the "threshold" value set in the Report generation properties. If it does, the class "failText" is added to the HTML tag, which is defined in the CSS stylesheet as having red text and background style:

.failText {
  background-color: red;
  color: white;
}