2

After running a test case with Karate, some html reports are published with surefire plugin. In particular, I've found that there is an html report for each feature file. This is inconvenient when tests are run from an automated pipeline, like in my case, where I use htmlpublish Jenkins plugin to get a public link to access reports and spread them across slack channels or emails.

I've tried to add this snippet in my pom.xml

      <plugin>
            <groupId>org.apache.maven.plugins</groupId>
            <artifactId>maven-surefire-report-plugin</artifactId>
            <version>2.4.2</version>
            <configuration>
                <aggregate>true</aggregate>
                <!--also set this to link to generated source reports-->
                <linkXRef>true</linkXRef>
            </configuration>
        </plugin>

But it had not the desired effect.

I'm trying to achieve a single index.html into the target/surefire-reports directory so i can publish and browse all test reports

Any suggestion? Thanks

Carmine Ingaldi
  • 856
  • 9
  • 23

1 Answers1

1

Are you using the parallel runner ? If not, please read up about it: https://github.com/intuit/karate#parallel-execution

Since we emit the cucumber-compatible JSON report in addition to the industry-standard JUnit XML format, you have the choice of any reporting solution that fits your needs. I think the maven-cucumber-reporting library should work for you - but you can decide: https://github.com/intuit/karate/tree/master/karate-demo#example-report

EDIT: For any other advanced needs, please consider writing your own report: https://stackoverflow.com/a/66773839/143475

Peter Thomas
  • 54,465
  • 21
  • 84
  • 248
  • 1
    Hello Peter! No, I'm not using parallel execution yet since we were afraid of race conditions, but it should just be matter of organizing scenario groupings. BTW, cucumber seems a good option, I've declared a runner for each package of my test base and a base runner, as suggested from your docs. Should I just edit the base runner to include cucumber report generation? It will be enough to genere just one html? – Carmine Ingaldi Jul 20 '19 at 07:33
  • @CarmineIngaldi just use one parallel runner with the cucumber report, this is what almost all projects do ! I recommend you stop over-thinking, drop everything else you are doing - and just do it – Peter Thomas Jul 20 '19 at 13:40
  • 1
    I (actually our automation engineer) tried to integrate cucumber reports and it works very fine, as well as parallel runner, assumed that features group right scenarios. Thanks Peter, for the answer but also for your cool software and the way help us to put into work . I'd like to give some help if needed! – Carmine Ingaldi Aug 06 '19 at 08:59