I read the following links, but no solution found yet:
- How to combine two cucumber runners
- Can I combine 2 cucumber reports generated by 2 Runners into a single one
- Any way to create one single Cucumber report for multiple feature files run by as many Runner classes?
Would it be possible to add a Java method in the Runner class to combine multiples, such as the following (last few lines specifically)? This would prevent us from coding multiple feature files specific to a user account and adding in conditional logic to prevent running based on account attributes, such as compliance state, region, ... and allow us to execute a single runner from our CI/CD pipeline for a full regression test of the service.
public class EquipmentRunner {
private static final String serviceName = "EquipmentService";
private static final Integer cores = Runtime.getRuntime().availableProcessors();
@Test
public void testParallel() {
Results baseAccountResults = Runner
.path("classpath:net/charter/equipment/test/api/domain/v1/Equipment_GET.feature")
.tags("@regression", "~@standarduser")
// .hook(new ExtentReportHook())
.karateEnv("dev_smb")
.outputCucumberJson(true)
.outputHtmlReport(true)
.outputJunitXml(true)
.systemProperty("karate.dsRow", "1")
.parallel(cores);
Results CoamAccountResults = Runner
.path("classpath:net/charter/equipment/test/api/domain/v1/Equipment_GET.feature")
.tags("@modem", "~@standarduser")
// .hook(new ExtentReportHook())
.karateEnv("dev_smb")
.outputCucumberJson(true)
.outputHtmlReport(true)
.outputJunitXml(true)
.systemProperty("karate.dsRow", "8")
.parallel(cores);
Results NonCompliantAccountResults = Runner
.path("classpath:net/charter/equipment/test/api/domain/v1/Equipment_GET.feature")
.tags("@nonCompliant")
// .hook(new ExtentReportHook())
.karateEnv("dev_smb")
.outputCucumberJson(true)
.outputHtmlReport(true)
.outputJunitXml(true)
.systemProperty("karate.username", "testCompliance")
.systemProperty("karate.password", "password")
.parallel(cores);
// This is where we would like to combine the results
Results results = baseAccountResults + CoamAccountResults + NonCompliantAccountResults;
// These would likely
generateReport(results.getReportDir());
assertEquals(0, results.getFailCount(), results.getErrorMessages());
}