是否可以使用Karate的JUnit5流利API生成Cucumber HTML报告? [英] Is it possible to generate Cucumber HTML Reports with Karate's JUnit5 fluent API?

查看:174
本文介绍了是否可以使用Karate的JUnit5流利API生成Cucumber HTML报告?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我们的团队正在通过空手道测试开始一个JUnit 5项目.

当前,我们将其用作空手道测试跑步者的模板 https: //github.com/intuit/karate#junit-5-parallel-execution .

它允许我们传递"target/surefire-reports",然后在测试完成之前调用ReportBuilder.generateReports().它与该代码基本上相同 https://github.com/intuit/karate/blob/b50202b3c8a8916a7db0f3d5196d42086ab80a04/karate-junit4/src/test/java/com/intuit/karate/mock/MockServerTest.java . /p>

这很好用,但是当我在研究如何设置JUnit 5时,我注意到了这个非常流畅的api 解决方案

好问题.我们将JUnit执行与并行运行器分离的原因是JUnit在开发模式下更有用,例如,您希望在IDE中获得详细的通过/失败统计信息.但这在"CI模式"下将是不必要的开销.

也就是说,我们已经进行了一些工作,使Parallel Runner成为一个流畅的界面,时间安排如此之好:)您可以在 https://github.com/intuit/karate /wiki/Developer-Guide

Our team is starting a JUnit 5 project with karate tests.

Currently we are using this as a template for our Karate test runner https://github.com/intuit/karate#junit-5-parallel-execution.

It allows us to pass in the "target/surefire-reports" and then before the test finishes we call ReportBuilder.generateReports(). It is basically identical to this code https://github.com/intuit/karate/blob/b50202b3c8a8916a7db0f3d5196d42086ab80a04/karate-junit4/src/test/java/com/intuit/karate/mock/MockServerTest.java.

This works well, but while I was looking at how to set up JUnit 5 I noticed this very slick fluent api https://github.com/intuit/karate#junit-5.

It would be nice to use that syntax, but I can't get the Cucumber report generated like I can with Runner.parallel. I made sure the maven-surefire-plugin was in build.gradle(although I could have messed that up) but it didn't seem to help.

I also tried doing ReportBuilder.generateReports() and the related logic from the parallel execution example in the @AfterAll function, but couldn't get that working either. The errors suggested that the target/surefire-reports folder didn't exist.

Is the cucumber report supported in the second example? If so, is there a trick to getting it setup?

解决方案

Great question. The reason we de-couple the JUnit execution and the parallel-runner - is JUnit is more useful in development mode, and you expect detailed pass/fail stats in the IDE for example. But this will be an un-necessary overhead in "CI mode".

That said, we have put in some work on making the Parallel runner a fluent interface, so great timing :) You can find an example on line 57 here.

May I request you to try the develop branch and see if you are missing anything ? Building is easy, here are some instructions: https://github.com/intuit/karate/wiki/Developer-Guide

这篇关于是否可以使用Karate的JUnit5流利API生成Cucumber HTML报告?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆