You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Hello, I encountered an issue after upgrading from Karate version 0.9.6 to version 1.5.0.RC4. The problem is that the cucumber.json report is not generated; instead, a .feature-json.txt file is generated.
I am using the following for my Karate project for automated tests:
Karate library 1.5.0.RC4
GraalVM 23.0.4
Java 21
Cucumber-reporting 5.8.2
Here is a code snippet:
public class DefaultCucumberRunner implements CucumberParallelRunner {
@Override
public Results run(CucumberRunnerParameters parameters) {
var directoryPath = getClassPackagePath(parameters.getRunningClass());
return Runner.path(getKarateFeaturePaths(directoryPath))
.outputJunitXml(true)
.outputCucumberJson(true)
.tags("~@ignore")
.parallel(parameters.getThreadCount());
}
private static List<String> getKarateFeaturePaths(String directoryPath) {
var featureFiles = FileUtils.listFiles(
new File(USER_DIRECTORY + FOLDER_SEPARATOR + directoryPath),
new String[] {KARATE_FEATURE_EXTENSION},
true
);
return featureFiles.stream()
.map(File::getPath)
.toList();
}
}
public class ReportGenerator {
private static final String CUCUMBER_HTML_REPORTS_PATH = "target/" + ReportBuilder.BASE_DIRECTORY;
private final ReportHandler reportHandler;
/** Clean up report directories. */
public static void cleanUpReportDirectories(String karateOutputPath) throws IOException {
FileUtils.deleteDirectory(new File(karateOutputPath));
FileUtils.deleteDirectory(new File(CUCUMBER_HTML_REPORTS_PATH));
}
/** Generate a cucumber HTML report. */
public void generateReport(String karateOutputPath, boolean isSuccessful) {
var karateOutputFile = new File(karateOutputPath);
if (!karateOutputFile.isDirectory()) {
throw new IllegalArgumentException(
"Karate report was not correctly created. This might be due to no Karate tests being launched.");
}
List<String> jsonPaths = FileUtils.listFiles(karateOutputFile, new String[]{"json"}, true)
.stream()
.map(File::getAbsolutePath)
.toList();
if (jsonPaths.isEmpty()) {
throw new IllegalArgumentException("No Karate JSON report files found.");
}
var config = new Configuration(new File("target"), "my-project-automatedtest");
config.setSortingMethod(SortingMethod.ALPHABETICAL);
var reportBuilder = new ReportBuilder(jsonPaths, config);
reportBuilder.generateReports();
var reportDir = new File(config.getReportDirectory(), ReportBuilder.BASE_DIRECTORY);
reportHandler.handleReport(reportDir, isSuccessful);
}
}
The issue is that with this version of Karate, even when adding the outputCucumberJson(true) option, I do not find a .json report in the output directory target/karate-reports. I only see .feature-json.txt reports and .html files. Consequently, when generating the report, I encounter an error indicating that the JSON file is not found in the directory. java.lang.IllegalArgumentException: No Karate JSON report files found.
The text was updated successfully, but these errors were encountered:
Hello, I encountered an issue after upgrading from Karate version 0.9.6 to version 1.5.0.RC4. The problem is that the cucumber.json report is not generated; instead, a .feature-json.txt file is generated.
I am using the following for my Karate project for automated tests:
Here is a code snippet:
The issue is that with this version of Karate, even when adding the
outputCucumberJson(true)
option, I do not find a.json
report in the output directorytarget/karate-reports
. I only see.feature-json.txt
reports and.html
files. Consequently, when generating the report, I encounter an error indicating that the JSON file is not found in the directory.java.lang.IllegalArgumentException: No Karate JSON report files found.
The text was updated successfully, but these errors were encountered: