Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Not able to generate a cucumber report when embed image is long #1201

Open
kotharisandy opened this issue Aug 13, 2024 · 2 comments
Open

Not able to generate a cucumber report when embed image is long #1201

kotharisandy opened this issue Aug 13, 2024 · 2 comments

Comments

@kotharisandy
Copy link

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)
image
@damianszczepanik
Copy link
Owner

This is not an issue with plugin upgrade - this is limitation, probably with memory

@gitissuepost
Copy link

gitissuepost commented Nov 6, 2024

@damianszczepanik - I seldom see this issue even with a high config machine with memory of around 32G and i am still on plugin version 5.7.7. However, we have few other reporter plugins dependent on the same json files, were able to generate the html reports without any exception.

[INFO] --- cucumber-reporting:5.7.7:generate (report) @ regression-suite --- [INFO] About to generate Cucumber report. [WARNING] Unexpected error net.masterthought.cucumber.ValidationException: File '/usr/eczpmt/wrkspc/db-test-suite/target/json-report/reconsile.json' is not a valid Cucumber report! String length (20054016) exceeds the maximum length (20000000) (through reference chain: java.lang.Object[][0]->net.masterthought.cucumber.json.Feature["elements"]->java.lang.Object[][26]->net.masterthought.cucumber.json.Element["steps"]->java.lang.Object[][2]->net.masterthought.cucumber.json.Step["embeddings"]->java.lang.Object[][0]) at net.masterthought.cucumber.ReportParser.parseForFeature(ReportParser.java:102) at net.masterthought.cucumber.ReportParser.parseJsonFiles(ReportParser.java:69) at net.masterthought.cucumber.ReportBuilder.generateReports(ReportBuilder.java:97) at net.masterthought.cucumber.CucumberReportGeneratorMojo.execute(CucumberReportGeneratorMojo.java:236) at org.apache.maven.plugin.DefaultBuildPluginManager.executeMojo(DefaultBuildPluginManager.java:126) at org.apache.maven.lifecycle.internal.MojoExecutor.doExecute2(MojoExecutor.java:328) at org.apache.maven.lifecycle.internal.MojoExecutor.doExecute(MojoExecutor.java:316) at org.apache.maven.lifecycle.internal.MojoExecutor.execute(MojoExecutor.java:212) at org.apache.maven.lifecycle.internal.MojoExecutor.execute(MojoExecutor.java:174) at org.apache.maven.lifecycle.internal.MojoExecutor.access$000(MojoExecutor.java:75) at org.apache.maven.lifecycle.internal.MojoExecutor$1.run(MojoExecutor.java:162) at org.apache.maven.plugin.DefaultMojosExecutionStrategy.execute(DefaultMojosExecutionStrategy.java:39) at org.apache.maven.lifecycle.internal.MojoExecutor.execute(MojoExecutor.java:159) at org.apache.maven.lifecycle.internal.LifecycleModuleBuilder.buildProject(LifecycleModuleBuilder.java:105) at org.apache.maven.lifecycle.internal.LifecycleModuleBuilder.buildProject(LifecycleModuleBuilder.java:73) at org.apache.maven.lifecycle.internal.builder.singlethreaded.SingleThreadedBuilder.build(SingleThreadedBuilder.java:53) at org.apache.maven.lifecycle.internal.LifecycleStarter.execute(LifecycleStarter.java:118) at org.apache.maven.DefaultMaven.doExecute(DefaultMaven.java:261) at org.apache.maven.DefaultMaven.doExecute(DefaultMaven.java:173) at org.apache.maven.DefaultMaven.execute(DefaultMaven.java:101) at org.jvnet.hudson.maven3.launcher.Maven35Launcher.main(Maven35Launcher.java:130) at java.base/jdk.internal.reflect.NativeMethodAccessorImpl.invoke0(Native Method) at java.base/jdk.internal.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62) at java.base/jdk.internal.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43) at java.base/java.lang.reflect.Method.invoke(Method.java:566) at org.codehaus.plexus.classworlds.launcher.Launcher.launchEnhanced(Launcher.java:255) at org.codehaus.plexus.classworlds.launcher.Launcher.launch(Launcher.java:201) at jenkins.maven3.agent.Maven35Main.launch(Maven35Main.java:178) at java.base/jdk.internal.reflect.NativeMethodAccessorImpl.invoke0(Native Method) at java.base/jdk.internal.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62) at java.base/jdk.internal.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43) at java.base/java.lang.reflect.Method.invoke(Method.java:566) at hudson.maven.Maven3Builder.call(Maven3Builder.java:139) at hudson.maven.Maven3Builder.call(Maven3Builder.java:70) at hudson.remoting.UserRequest.perform(UserRequest.java:211) at hudson.remoting.UserRequest.perform(UserRequest.java:54) at hudson.remoting.Request$2.run(Request.java:376) at hudson.remoting.InterceptingExecutorService.lambda$wrap$0(InterceptingExecutorService.java:78) at java.base/java.util.concurrent.FutureTask.run(FutureTask.java:264) at java.base/java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1128) at java.base/java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:628) at java.base/java.lang.Thread.run(Thread.java:829) Caused by: com.fasterxml.jackson.core.exc.StreamConstraintsException: String length (20054016) exceeds the maximum length (20000000) at com.fasterxml.jackson.core.StreamReadConstraints.validateStringLength(StreamReadConstraints.java:324) at com.fasterxml.jackson.core.util.ReadConstrainedTextBuffer.validateStringLength(ReadConstrainedTextBuffer.java:27) at com.fasterxml.jackson.core.util.TextBuffer.finishCurrentSegment(TextBuffer.java:939) at com.fasterxml.jackson.core.json.ReaderBasedJsonParser._finishString2(ReaderBasedJsonParser.java:2240) at com.fasterxml.jackson.core.json.ReaderBasedJsonParser._finishString(ReaderBasedJsonParser.java:2206) at com.fasterxml.jackson.core.json.ReaderBasedJsonParser.getText(ReaderBasedJsonParser.java:323) at com.fasterxml.jackson.databind.deser.std.BaseNodeDeserializer._deserializeContainerNoRecursion(JsonNodeDeserializer.java:572) at com.fasterxml.jackson.databind.deser.std.JsonNodeDeserializer.deserialize(JsonNodeDeserializer.java:100) at com.fasterxml.jackson.databind.deser.std.JsonNodeDeserializer.deserialize(JsonNodeDeserializer.java:25) at com.fasterxml.jackson.databind.deser.DefaultDeserializationContext.readRootValue(DefaultDeserializationContext.java:323) at com.fasterxml.jackson.databind.ObjectMapper._readValue(ObjectMapper.java:4801) at com.fasterxml.jackson.databind.ObjectMapper.readTree(ObjectMapper.java:3084) at net.masterthought.cucumber.json.deserializers.CucumberJsonDeserializer.deserialize(CucumberJsonDeserializer.java:25) at net.masterthought.cucumber.json.deserializers.EmbeddingDeserializer.deserialize(EmbeddingDeserializer.java:22) at com.fasterxml.jackson.databind.deser.std.ObjectArrayDeserializer.deserialize(ObjectArrayDeserializer.java:216) at com.fasterxml.jackson.databind.deser.std.ObjectArrayDeserializer.deserialize(ObjectArrayDeserializer.java:26) at com.fasterxml.jackson.databind.deser.impl.FieldProperty.deserializeAndSet(FieldProperty.java:138) at com.fasterxml.jackson.databind.deser.BeanDeserializer.vanillaDeserialize(BeanDeserializer.java:314) at com.fasterxml.jackson.databind.deser.BeanDeserializer.deserialize(BeanDeserializer.java:177) at com.fasterxml.jackson.databind.deser.std.ObjectArrayDeserializer.deserialize(ObjectArrayDeserializer.java:216) at com.fasterxml.jackson.databind.deser.std.ObjectArrayDeserializer.deserialize(ObjectArrayDeserializer.java:26) at com.fasterxml.jackson.databind.deser.impl.FieldProperty.deserializeAndSet(FieldProperty.java:138) at com.fasterxml.jackson.databind.deser.BeanDeserializer.vanillaDeserialize(BeanDeserializer.java:314) at com.fasterxml.jackson.databind.deser.BeanDeserializer.deserialize(BeanDeserializer.java:177) at com.fasterxml.jackson.databind.deser.std.ObjectArrayDeserializer.deserialize(ObjectArrayDeserializer.java:216) at com.fasterxml.jackson.databind.deser.std.ObjectArrayDeserializer.deserialize(ObjectArrayDeserializer.java:26) at com.fasterxml.jackson.databind.deser.impl.FieldProperty.deserializeAndSet(FieldProperty.java:138) at com.fasterxml.jackson.databind.deser.BeanDeserializer.vanillaDeserialize(BeanDeserializer.java:314) at com.fasterxml.jackson.databind.deser.BeanDeserializer.deserialize(BeanDeserializer.java:177) at com.fasterxml.jackson.databind.deser.std.ObjectArrayDeserializer.deserialize(ObjectArrayDeserializer.java:216) at com.fasterxml.jackson.databind.deser.std.ObjectArrayDeserializer.deserialize(ObjectArrayDeserializer.java:26) at com.fasterxml.jackson.databind.deser.DefaultDeserializationContext.readRootValue(DefaultDeserializationContext.java:323) at com.fasterxml.jackson.databind.ObjectMapper._readMapAndClose(ObjectMapper.java:4825) at com.fasterxml.jackson.databind.ObjectMapper.readValue(ObjectMapper.java:3785) at net.masterthought.cucumber.ReportParser.parseForFeature(ReportParser.java:90)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants