Shrikant
Shrikant

Reputation: 101

Cucumber reports stopped getting generated after i ran mvn clean install command for my karate project

I was getting cucumber reports generated for my Karate project, however, soon after i ran mvn clean install command from my project terminal, some stuff from the target or resources directory got deleted & since then cucumber reports are not getting generated, even though there are no code changes anywhere. Could you please help me fix this one.

I tried to revert the project state to one before i ran the mvn clean install command, but no luck. I am still unable to generate the report as i did earlier.

Given below is my runner.java file code:

@KarateOptions(tags = {"~@ignore"})

public class ApiRunner {

@Test
public void testParallel() {
Results results = Runner.parallel(getClass(), 5, "target/surefire- 
reports");
assertTrue(results.getErrorMessages(), results.getFailCount() == 0);
}

public static void generateReport(String basePath) {
Collection<File> jsonFiles =org.apache.commons.io.FileUtils.listFiles(new 
File(basePath), new String[]{"json"}, true);
List<String> jsonPaths = new ArrayList(jsonFiles.size());
jsonFiles.forEach(file -> jsonPaths.add(file.getAbsolutePath()));
Configuration config = new Configuration(new File(basePath), basePath);
ReportBuilder reportBuilder = new ReportBuilder(jsonPaths, config);
reportBuilder.generateReports();
}

}

Consolidated Cucumber html reports for all features should get generated successfully after the runner.java file is run.

Upvotes: 1

Views: 535

Answers (1)

Adrien
Adrien

Reputation: 1090

You are missing the call to the generateReport function in testParallel.

Add this line before the assertTrue :

generateReport(results.getReportDir());

Upvotes: 2

Related Questions