问题描述
我们的团队正在通过空手道测试开始一个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 https://github.com/intuit/karate#junit-5 .
使用该语法会很好,但是我无法像Runner.parallel一样生成Cucumber报告.我确保了maven-surefire-plugin在build.gradle中(尽管我可能把它搞砸了),但这似乎没有帮助.
我还尝试了ReportBuilder.generateReports()和相关逻辑,来自@AfterAll函数中的并行执行示例,但也无法正常工作.该错误表明target/surefire-reports文件夹不存在.
第二个示例支持黄瓜报告吗?如果是这样,是否有设置它的窍门?
好问题.我们将JUnit执行与并行运行器分离的原因是JUnit在开发模式下更有用,例如,您希望在IDE中获得详细的通过/失败统计信息.但这在"CI模式"下将是不必要的开销.
也就是说,我们已经进行了一些工作,使Parallel Runner成为一个流畅的界面,时间安排如此之好:)您可以在此处的第57行.
我可以请您尝试使用develop
分支,看看您是否缺少任何东西吗?构建很容易,这里有一些说明: 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报告?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!