damianszczepanik / cucumber-reporting

HTML reports for Cucumber
GNU Lesser General Public License v2.1
548 stars 403 forks source link

Trends file is not updated after the test is completed #1038

Closed MadhuQAAutomation closed 2 years ago

MadhuQAAutomation commented 2 years ago

Hi Damian - I am using cucumber-maven-reporting 5.6.2 plugin. I have mentioned the path of the trends file and the trends limit in the pom.xml file. However after the test is completed, trends.json is not getting updated due to which getting the below exception.

Maven -cucumber-Reporting config in pom.xml: `

net.masterthought
            <artifactId>maven-cucumber-reporting</artifactId>
            <version>${cucumber.report.plugin}</version>
            <executions>
                <execution>
                    <id>execution</id>
                    <phase>verify</phase>
                    <goals>
                        <goal>generate</goal>
                    </goals>
                    <configuration>
                        <projectName>TEST-AUTOMATION</projectName>
                        <outputDirectory>${project.basedir}/reports/html-reports</outputDirectory>
                        <inputDirectory>${project.basedir}/reports/cucumber/json/</inputDirectory>
                        <jsonFiles>
                            <jsonFile>cucumber.json</jsonFile>
                        </jsonFiles>
                        <trendsFile>${project.basedir}/reports/cucumber/trends/trends.json</trendsFile>
                        <trendsLimit>5</trendsLimit>
                        <checkBuildResult>true</checkBuildResult>
                        <treatPendingAsFailed>false</treatPendingAsFailed>
                        <treatSkippedAsFailed>true</treatSkippedAsFailed>
                        <treatUndefinedAsFailed>false</treatUndefinedAsFailed>
                        <treatScenariosAsFailed>true</treatScenariosAsFailed>
                        <setSkippedAsNotFailing>false</setSkippedAsNotFailing>
                        <mergeFeaturesById>false</mergeFeaturesById>
                    </configuration>
                </execution>
            </executions>
        </plugin>`

Exception : INFO: Unexpected error net.masterthought.cucumber.ValidationException: File 'D:\AutomationCodeBase\test-automation\reports\cucumber\trends\trends.json' could not be parsed as file with trends! at net.masterthought.cucumber.ReportBuilder.loadTrends(ReportBuilder.java:238) at net.masterthought.cucumber.ReportBuilder.loadOrCreateTrends(ReportBuilder.java:228) at net.masterthought.cucumber.ReportBuilder.updateAndSaveTrends(ReportBuilder.java:211) at net.masterthought.cucumber.ReportBuilder.generateReports(ReportBuilder.java:103) at net.masterthought.cucumber.CucumberReportGeneratorMojo.execute(CucumberReportGeneratorMojo.java:236) at org.apache.maven.plugin.DefaultBuildPluginManager.executeMojo(DefaultBuildPluginManager.java:137) at org.apache.maven.lifecycle.internal.MojoExecutor.execute(MojoExecutor.java:210) at org.apache.maven.lifecycle.internal.MojoExecutor.execute(MojoExecutor.java:156) at org.apache.maven.lifecycle.internal.MojoExecutor.execute(MojoExecutor.java:148) at org.apache.maven.lifecycle.internal.LifecycleModuleBuilder.buildProject(LifecycleModuleBuilder.java:117) at org.apache.maven.lifecycle.internal.LifecycleModuleBuilder.buildProject(LifecycleModuleBuilder.java:81) at org.apache.maven.lifecycle.internal.builder.singlethreaded.SingleThreadedBuilder.build(SingleThreadedBuilder.java:56) at org.apache.maven.lifecycle.internal.LifecycleStarter.execute(LifecycleStarter.java:128) at org.apache.maven.DefaultMaven.doExecute(DefaultMaven.java:305) at org.apache.maven.DefaultMaven.doExecute(DefaultMaven.java:192) at org.apache.maven.DefaultMaven.execute(DefaultMaven.java:105) at org.apache.maven.cli.MavenCli.execute(MavenCli.java:972) at org.apache.maven.cli.MavenCli.doMain(MavenCli.java:293) at org.apache.maven.cli.MavenCli.main(MavenCli.java:196) 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:282) at org.codehaus.plexus.classworlds.launcher.Launcher.launch(Launcher.java:225) at org.codehaus.plexus.classworlds.launcher.Launcher.mainWithExitCode(Launcher.java:406) at org.codehaus.plexus.classworlds.launcher.Launcher.main(Launcher.java:347) at org.codehaus.classworlds.Launcher.main(Launcher.java:47) Caused by: com.fasterxml.jackson.databind.exc.MismatchedInputException: No content to map due to end-of-input at [Source: (InputStreamReader); line: 1, column: 0] at com.fasterxml.jackson.databind.exc.MismatchedInputException.from(MismatchedInputException.java:59) at com.fasterxml.jackson.databind.ObjectMapper._initForReading(ObjectMapper.java:4688) at com.fasterxml.jackson.databind.ObjectMapper._readMapAndClose(ObjectMapper.java:4586) at com.fasterxml.jackson.databind.ObjectMapper.readValue(ObjectMapper.java:3561) at net.masterthought.cucumber.ReportBuilder.loadTrends(ReportBuilder.java:236) ... 27 more

MadhuQAAutomation commented 2 years ago

I deleted the trends.json and reran the test. It worked now..