How to fail a Jenkins job based on pass rate threshold of testng tests
<p>We are trying to use Jenkins as our CI/CD solution, and want ability to fail a deployment if our TestNG tests do not meet a set pass rate threshold.   </p>

<p>Currently our Jenkins job executes our TestNG tests via maven, thus any test failure marks the build as failed. I.e. anything less than 100% pass rate, will fail the build job.</p>

<p>We want ability to make it configurable - i.e. fail the test job if pass rate is below, say, 98%.  </p>

<p>Is this something i can control or configure inside the Jenkins job via some plugin, or is it something i have to code for inside TestNG listeners, i.e. <code>onFinish()</code> and set the return value based on the calculated pass rate?</p>