我在Java文件中设置了以下代码:
@CucumberOptions(tags = {"~@ignore"})
public class ExamplesTest {
@BeforeClass
public static void before() {
System.setProperty("karate.env", "dev");
}
@Test
public void testParallel() {
String karateOutputPath = "target/surefire-reports";
KarateStats stats = CucumberRunner.parallel(getClass(), 1, karateOutputPath);
generateReport(karateOutputPath);
assertTrue("there are scenario failures", stats.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"), "demo");
ReportBuilder reportBuilder = new ReportBuilder(jsonPaths, config);
reportBuilder.generateReports();
}
}
如您所见,我将线程数设置为1,但是即使我将其增加,执行时间也没有差异。
我不太确定并行运行的方式。
有人可以解释吗?
答案 0 :(得分:0)
当前并行化的单位是在功能文件级别。这意味着: