Karate 0.9.5 : Can't get command line options in parallel execution

放肆的年华 提交于 2021-01-28 00:34:08

问题


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

标签
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!