public static File saveKarateJson(String targetDir, FeatureResult result, String fileName) {
        if (fileName == null) {
            fileName = result.getFeature().getKarateJsonFileName();
        }
        File file = new File(targetDir + File.separator + fileName);
        FileUtils.writeToFile(file, JsonUtils.toJson(result.toKarateJson()));
        return file;
    }
@Test
    void testReport() {
        final ByteArrayOutputStream outContent = new ByteArrayOutputStream();
        final PrintStream originalOut = System.out;
        Feature feature = Feature.read("classpath:com/intuit/karate/report/test.feature");
        FeatureRuntime fr = FeatureRuntime.of(feature);
        fr.run();
        Report report = SuiteReports.DEFAULT.featureReport(fr.suite, fr.result);
        File file = report.render("target/report-test");
        String html = FileUtils.toString(file);
        assertTrue(html.contains("<title>com.intuit.karate.report.test</title>"));
        assertTrue(html.contains("<img src=\"karate-labs-logo-ring.svg\" alt=\"Karate Labs\"/>"));
        assertTrue(html.contains("<div>Scenarios</div>"));
        assertTrue(html.contains("<a href=\"karate-summary.html\">Summary</a><span class=\"feature-label\">|</span>"));
        System.setOut(new PrintStream(outContent)); // Capture console output
        fr.suite.buildResults();
        assertFalse(outContent.toString().contains(" | env: "));
        System.setOut(originalOut); // restore console output
        // render summary report
        Runner.Builder builder = new Runner.Builder();
        builder.reportDir("target/report-test");
        Suite suite = new Suite(builder);
        File jsonFile = ReportUtils.saveKarateJson("target/report-test", fr.result, null);
        suite.featureResultFiles.add(jsonFile);
        Results results = Results.of(suite);  // this will render summary via constructor TODO improve        
    }