空手道API框架 - 测试依赖性
在我的回归套件中,我有600多个测试用例。所有这些测试都有@RegressionTest标签。请参阅下面,我的运行方式。
_start = LocalDateTime.now();
//see karate-config.js files for env options
_logger.info("karate.env = " + System.getProperty("karate.env"));
System.setProperty("karate.env", "test");
Results results = Runner.path("classpath:functional/Commercial/").tags("@RegressionTest").reportDir(reportDir).parallel(5);
generateReport(results.getReportDir());
assertEquals(0, results.getFailCount(), results.getErrorMessages());
我认为,我可以创建1个测试并给它一个标签@smoketest。我希望能够运行该测试第一,并且只有当该测试通过时,才能运行整个回归套件。如何实现此功能?我正在使用junit5和barate.runner。
In my regression suite I have 600+ test cases. All those tests have @RegressionTest tag. See below, how I am running.
_start = LocalDateTime.now();
//see karate-config.js files for env options
_logger.info("karate.env = " + System.getProperty("karate.env"));
System.setProperty("karate.env", "test");
Results results = Runner.path("classpath:functional/Commercial/").tags("@RegressionTest").reportDir(reportDir).parallel(5);
generateReport(results.getReportDir());
assertEquals(0, results.getFailCount(), results.getErrorMessages());
I am thinking that, I can create 1 test and give it a tag @smokeTest. I want to be able to run that test 1st and only if that test passes then run the entire Regression suite. How can I achieve this functionality? I am using Junit5 and Karate.runner.
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
我认为最简单的事情是在Junit本身中进行一次测试,如果失败,请进行异常或跳过实际测试。
因此,两次使用
Runner
。否则,请考虑这不直接在空手道中支持,但欢迎代码限制。
另请参阅此问题的答案:如何在空手道中重新旋转失败的功能?
I think the easiest thing to do is run one test in JUnit itself, and if that fails, throw an Exception or skip running the actual tests.
So use the
Runner
two times.Otherwise consider this not supported directly in Karate but code-contributions are welcome.
Also refer to the answers to this question: How to rerun failed features in karate?