Home > database >  Karate API framework- test dependency
Karate API framework- test dependency

Time:05-16

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.

CodePudding user response:

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?

  • Related