How to add an option to Cucumber report to remove scenarios that have a certain tag

Karate 1.0 has overhauled the reporting system with the following key changes.

  • after the Runner completes you can massage the results and even re-try some tests
  • you can inject a custom HTML report renderer

This will require you to get into the details (some of this is not documented yet) and write some Java code. If that is not an option, you have to consider that what you are asking for is not supported by Karate.

If you are willing to go down that path, here are the links you need to get started.

a) Example of how to “post process” result-data before rendering a report: RetryTest.java and also see https://stackoverflow.com/a/67971681/143475

b) The code responsible for “pluggable” reports, where you can implement a new SuiteReports in theory. And in the Runner, there is a suiteReports() method you can call to provide your implementation.

Also note that there is an experimental “doc” keyword, by which you can inject custom HTML into a test-report: https://twitter.com/getkarate/status/1338892932691070976

Also see: https://twitter.com/KarateDSL/status/1427638609578967047

Leave a Comment