问题
I am trying to update my project to the last karate release 0.9.5. All works fine except the parallel execution. It doesn't take in account the tags I run using the command line "-Dkarate.options".
This is my TestParallel java class:
public class QaaTestParallel {
@Test
public void testParallel() {
Results results = Runner.path("classpath:e2e").parallel(2);
generateReport(results.getReportDir());
assertTrue(results.getErrorMessages(), results.getFailCount() == 0);
}
public static void generateReport(String karateOutputPath) {
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("target"), "e2e Karate");
config.setNotFailingStatuses(Collections.singleton(Status.SKIPPED));
config.setSortingMethod(SortingMethod.ALPHABETICAL);
ReportBuilder reportBuilder = new ReportBuilder(jsonPaths, config);
reportBuilder.generateReports();
}
}
To run the tests I use the following command line instruction:
mvn clean test -Dkarate.options="--tags @smoke" -Dtest=QaaTestParallel
But it runs all my tests.
I tried different options but I didn't get to work. Can anyone give me a hand?
Thanks a lot.
回答1:
Yes we missed this, it is a bug. I have fixed this in the develop
branch. It would help us a lot if you can build and test this locally, it is simple: https://github.com/intuit/karate/issues/1061
For now, use the old annotation way as a work-around, or create a new runner where the tag combination is "hard coded".
来源:https://stackoverflow.com/questions/60412123/karate-0-9-5-cant-get-command-line-options-in-parallel-execution