Sometimes when I run a test on jenkins with logical OR tag selection (karate.options="--tags @vld,@command-composition") the tests are executed unitl the end but will never step out of
Results results = Runner.parallel(getClass(),5 , karateOutputPath);
This is definetly a problem concerning karate AND jenkins because when executed on a local machine, the problem never occured.
Also when the tags are selected separatelly (eg. "--tags @vld" or "--tags @command-composition") the problem does not occure. Even on jenkins.
This is my parallel runner class used for executing the tests in parallel. I added some logging debug outputs in order to clarify where the execution is running into an infinite loop.
The execution is not stepping out of test execution:
Results results = Runner.parallel(getClass(),5 , karateOutputPath);
and therefore everything after (including)
logger.debug("DEBUG-LOG: AFTER TEST - BEFORE REPORT GENERATION");
is never executed.
@KarateOptions(tags = {"~@ignore"})
public class ParallelRunner {
private static final Logger logger = LoggerFactory.getLogger("com.intuit.karate");
@Test
public void testParallel() throws IOException {
// RESET LAST USED ICCID
Helper.resetLastIccid();
String outputPath = "build";
String karateOutputPath = outputPath + "/surefire-reports";
logger.debug("DEBUG-LOG: BEFORE TEST");
Results results = Runner.parallel(getClass(),5 , karateOutputPath);
logger.debug("DEBUG-LOG: AFTER TEST - BEFORE REPORT GENERATION");
generateReport(karateOutputPath);
logger.debug("DEBUG-LOG: AFTER GEN REPORT");
assertTrue("scenarios failed", results.getFailCount() == 0);
}
private static void generateReport(String karateOutputPath) {
logger.debug("DEBUG-LOG: IN GEN REPORT");
Collection<File> jsonFiles = FileUtils.listFiles(new File(karateOutputPath), new String[] {"json"}, true);
List<String> jsonPaths = new ArrayList(jsonFiles.size());
jsonFiles.forEach(file -> jsonPaths.add(file.getAbsolutePath()));
Configuration config = new Configuration(new File("build"), "MH Conan Mobile Systemtest");
ReportBuilder reportBuilder = new ReportBuilder(jsonPaths, config);
reportBuilder.generateReports();
}
}
I also played arround with the number of used threads and parallel execution==false. Nothing seems to help.
I also compared the surefire-reports output folder between a local run and a jenkins build. All surefire reports for the executed features are there but on jenkins the results-json.txt and timeline.html is missing.
So, is there anyone out there who has also experienced this kind of behaviour? Or has someone further ideas how to debug or at least narrow down this problem somehow?
Help is very much appreciated! :)
Karate-Version: 0.9.2 (latest)