空手道API框架 - 测试依赖性

发布于 2025-01-29 16:46:31 字数 644 浏览 1 评论 0原文

在我的回归套件中,我有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 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(1

苏佲洛 2025-02-05 16:46:31

我认为最简单的事情是在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?

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文