简体   繁体   English

空手道 API 框架 - 测试依赖

[英]Karate API framework- test dependency

In my regression suite I have 600+ test cases.在我的回归套件中,我有 600 多个测试用例。 All those tests have @RegressionTest tag.所有这些测试都有@RegressionTest 标签。 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.我在想,我可以创建 1 个测试并给它一个标签 @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.我正在使用 Junit5 和 Karate.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.我认为最简单的做法是在 JUnit 本身中运行一个测试,如果失败,则抛出异常或跳过运行实际测试。

So use the Runner two times.所以使用Runner两次。

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?另请参阅此问题的答案:如何在空手道中重新运行失败的功能?

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM