To use cucumber reporting in your karate project, you first need to add the maven dependency.

Maven Dependency

Add the net.masterthought:cucumber-reporting jar as a dependency in test scope


Since the maven-cucumber-reporting plugin has an issue where reports will not be generated if the build fails, we recommend that you directly use the cucumber-reporting library programmatically in combination with the Karate parallel runner. Here is how:

package gitAutomation;
import net.masterthought.cucumber.Configuration;
import net.masterthought.cucumber.ReportBuilder;
import org.junit.Test;
import java.util.ArrayList;
import java.util.Collection;
import java.util.List;
import static org.junit.Assert.assertTrue;
//DO NOT USE @ RUN WITH(Karate.class) 
@KarateOptions(features = "classpath:gitAutomation/deleteRepoDynamicOutline.feature")
public class gitRunnerCucumberReport {
    public void testParallel() {
        //System.setProperty("karate.env", "demo"); // ensure reset if other tests (e.g. mock) had set env in CI
// Specify your feature here       
 Results results = Runner.path("classpath:gitAutomation").tags("~@ignore").parallel(5);
        assertTrue(results.getErrorMessages(), results.getFailCount() == 0);
// Generate report method to generate the report
    public static void generateReport(String karateOutputPath) {
        Collection<File> jsonFiles = FileUtils.listFiles(new File(karateOutputPath), new String[] {"json"}, true);
        List<String> jsonPaths = new ArrayList(jsonFiles.size());
        jsonFiles.forEach(file -> jsonPaths.add(file.getAbsolutePath()));
//Specify the folder where to want to generate the feature file
        Configuration config = new Configuration(new File("target"), "gitAutomation");
        ReportBuilder reportBuilder = new ReportBuilder(jsonPaths, config);

You can run the above runner class and the report will get generated in your specified folder.

Karate external report, Cucumber karate reporting, karate dsl tetsing