cucumber-reporting
cucumber-reporting copied to clipboard
Not able to generate a cucumber report when embed image is long
After upgrading net.masterthought dependency to 5.8.2 the cucumber reporting through is notd generating reports when embedded image size is long
List<String> jsonFiles = new ArrayList();
jsonFiles.add(cucumberFolder);
String reportName = PropertyUtils.get(ConfigMap.REPORT_NAME) != null && !Objects.requireNonNull(PropertyUtils.get(ConfigMap.REPORT_NAME)).isEmpty() ? PropertyUtils.get(ConfigMap.REPORT_NAME) : "Cucumber Report";
Configuration configuration = new Configuration(reportOutputDirectory, reportName);
String envName = SessionInitiator.getInstance().getEnvironment();
if (envName.equalsIgnoreCase("ode")) {
envName = "ODE ( " + PropertyUtils.get(ConfigMap.NAME_SPACE) + " ) ";
}
String buildNumber = "1";
configuration.setNotFailingStatuses(Collections.singleton(Status.SKIPPED));
configuration.setBuildNumber(buildNumber);
configuration.addClassifications("Environment Name ", envName);
configuration.addClassifications("Automation Tag Name", PropertyUtils.get("cucumber.filter.tags") != null ? PropertyUtils.get("cucumber.filter.tags") : "");
configuration.addClassifications("Run By :", PropertyUtils.get(ConfigMap.AUTOMATION_RUN_BY) != null ? PropertyUtils.get(ConfigMap.AUTOMATION_RUN_BY) : "");
configuration.addClassifications("Platform", System.getProperty("os.name"));
if (Objects.requireNonNull(PropertyUtils.get(ConfigMap.AUTOMATION_TYPE)).equalsIgnoreCase("MWEB") || Objects.requireNonNull(PropertyUtils.get(ConfigMap.AUTOMATION_TYPE)).equalsIgnoreCase("DWEB")) {
configuration.addClassifications("Platform", SessionInitiator.getInstance().getBrowser());
} else if (Objects.requireNonNull(PropertyUtils.get(ConfigMap.AUTOMATION_TYPE)).equalsIgnoreCase("APP")) {
configuration.addClassifications("App Device Type", SessionInitiator.getInstance().getPlatformType());
}
configuration.addPresentationModes(PresentationMode.PARALLEL_TESTING);
configuration.addPresentationModes(PresentationMode.EXPAND_ALL_STEPS);
configuration.setQualifier("cucumber-report-1", "First report");
try {
ReportBuilder reportBuilder = new ReportBuilder(jsonFiles, configuration);
Reportable result = reportBuilder.generateReports();
} catch (Exception e) {
}
Getting below errror message after generating report from above code
net.masterthought.cucumber.ValidationException: File 'target/cucumber-reports/Cucumber.json' is not a valid Cucumber report! String value length (20054016) exceeds the maximum allowed (20000000, from `StreamReadConstraints.getMaxStringLength()`) (through reference chain: java.lang.Object[][1]->net.masterthought.cucumber.json.Feature["elements"]->java.lang.Object[][0]->net.masterthought.cucumber.json.Element["after"]->java.lang.Object[][0]->net.masterthought.cucumber.json.Hook["embeddings"]->java.lang.Object[][0])
at net.masterthought.cucumber.ReportParser.parseForFeature(ReportParser.java:104)
at net.masterthought.cucumber.ReportParser.parseJsonFiles(ReportParser.java:71)
at net.masterthought.cucumber.ReportBuilder.generateReports(ReportBuilder.java:97)
at java.base/jdk.internal.reflect.DirectMethodHandleAccessor.invoke(DirectMethodHandleAccessor.java:104)
at java.base/java.lang.reflect.Method.invoke(Method.java:578)
at org.testng.internal.invokers.MethodInvocationHelper.invokeMethod(MethodInvocationHelper.java:141)
at org.testng.internal.invokers.MethodInvocationHelper.invokeMethodConsideringTimeout(MethodInvocationHelper.java:71)
at org.testng.internal.invokers.ConfigInvoker.invokeConfigurationMethod(ConfigInvoker.java:400)
at org.testng.internal.invokers.ConfigInvoker.invokeConfigurations(ConfigInvoker.java:333)
at org.testng.SuiteRunner.privateRun(SuiteRunner.java:386)
at org.testng.SuiteRunner.run(SuiteRunner.java:312)
at org.testng.SuiteRunnerWorker.runSuite(SuiteRunnerWorker.java:52)
at org.testng.SuiteRunnerWorker.run(SuiteRunnerWorker.java:95)
at org.testng.TestNG.runSuitesSequentially(TestNG.java:1274)
at org.testng.TestNG.runSuitesLocally(TestNG.java:1208)
at org.testng.TestNG.runSuites(TestNG.java:1112)
at org.testng.TestNG.run(TestNG.java:1079)
at org.apache.maven.surefire.testng.TestNGExecutor.run(TestNGExecutor.java:155)
at org.apache.maven.surefire.testng.TestNGDirectoryTestSuite.executeSingleClass(TestNGDirectoryTestSuite.java:102)
at org.apache.maven.surefire.testng.TestNGDirectoryTestSuite.execute(TestNGDirectoryTestSuite.java:91)
at org.apache.maven.surefire.testng.TestNGProvider.invoke(TestNGProvider.java:137)
at org.apache.maven.surefire.booter.ForkedBooter.runSuitesInProcess(ForkedBooter.java:385)
at org.apache.maven.surefire.booter.ForkedBooter.execute(ForkedBooter.java:162)
at org.apache.maven.surefire.booter.ForkedBooter.run(ForkedBooter.java:507)
at org.apache.maven.surefire.booter.ForkedBooter.main(ForkedBooter.java:495)
Caused by: com.fasterxml.jackson.core.exc.StreamConstraintsException: String value length (20054016) exceeds the maximum allowed (20000000, from `StreamReadConstraints.getMaxStringLength()`)
at com.fasterxml.jackson.core.StreamReadConstraints._constructException(StreamReadConstraints.java:549)
at com.fasterxml.jackson.core.StreamReadConstraints.validateStringLength(StreamReadConstraints.java:484)
at com.fasterxml.jackson.core.util.ReadConstrainedTextBuffer.validateStringLength(ReadConstrainedTextBuffer.java:27)
at com.fasterxml.jackson.core.util.TextBuffer.finishCurrentSegment(TextBuffer.java:946)
at com.fasterxml.jackson.core.json.ReaderBasedJsonParser._finishString2(ReaderBasedJsonParser.java:2208)
at com.fasterxml.jackson.core.json.ReaderBasedJsonParser._finishString(ReaderBasedJsonParser.java:2174)
at com.fasterxml.jackson.core.json.ReaderBasedJsonParser.getText(ReaderBasedJsonParser.java:295)
at com.fasterxml.jackson.databind.deser.std.BaseNodeDeserializer._deserializeContainerNoRecursion(JsonNodeDeserializer.java:572)