Cucumber html report isn't getting generated and getting error. Please find below error, json, build.gradle, and runner class detail. Appreciate your help.
error
net.masterthought.cucumber.ValidationException: File 'target/cucumber-json-report.json' is not proper Cucumber report!
at net.masterthought.cucumber.ReportParser.parseForFeature(ReportParser.java:90)
at net.masterthought.cucumber.ReportParser.parseJsonFiles(ReportParser.java:61)
at net.masterthought.cucumber.ReportBuilder.generateReports(ReportBuilder.java:88)
at com.abc.runner.TestRunner.generateCucumberReports(TestRunner.java:53)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
at java.lang.reflect.Method.invoke(Method.java:498)
at org.junit.runners.model.FrameworkMethod$1.runReflectiveCall(FrameworkMethod.java:50)
at org.junit.internal.runners.model.ReflectiveCallable.run(ReflectiveCallable.java:12)
at org.junit.runners.model.FrameworkMethod.invokeExplosively(FrameworkMethod.java:47)
at org.junit.internal.runners.statements.RunAfters.evaluate(RunAfters.java:33)
at org.junit.runners.ParentRunner.run(ParentRunner.java:363)
at cucumber.api.junit.Cucumber.run(Cucumber.java:100)
at org.junit.runner.JUnitCore.run(JUnitCore.java:137)
at com.intellij.junit4.JUnit4IdeaTestRunner.startRunnerWithArgs(JUnit4IdeaTestRunner.java:68)
at com.intellij.rt.execution.junit.IdeaTestRunner$Repeater.startRunnerWithArgs(IdeaTestRunner.java:47)
at com.intellij.rt.execution.junit.JUnitStarter.prepareStreamsAndStart(JUnitStarter.java:242)
at com.intellij.rt.execution.junit.JUnitStarter.main(JUnitStarter.java:70)
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:4133)
at com.fasterxml.jackson.databind.ObjectMapper._readMapAndClose(ObjectMapper.java:3988)
at com.fasterxml.jackson.databind.ObjectMapper.readValue(ObjectMapper.java:3037)
at net.masterthought.cucumber.ReportParser.parseForFeature(ReportParser.java:84)
... 18 more
Hi damianszczepanik,
Cucumber html report isn't getting generated and getting error. Please find below error, json, build.gradle, and runner class detail. Appreciate your help.
error net.masterthought.cucumber.ValidationException: File 'target/cucumber-json-report.json' is not proper Cucumber report! at net.masterthought.cucumber.ReportParser.parseForFeature(ReportParser.java:90) at net.masterthought.cucumber.ReportParser.parseJsonFiles(ReportParser.java:61) at net.masterthought.cucumber.ReportBuilder.generateReports(ReportBuilder.java:88) at com.abc.runner.TestRunner.generateCucumberReports(TestRunner.java:53) at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62) at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43) at java.lang.reflect.Method.invoke(Method.java:498) at org.junit.runners.model.FrameworkMethod$1.runReflectiveCall(FrameworkMethod.java:50) at org.junit.internal.runners.model.ReflectiveCallable.run(ReflectiveCallable.java:12) at org.junit.runners.model.FrameworkMethod.invokeExplosively(FrameworkMethod.java:47) at org.junit.internal.runners.statements.RunAfters.evaluate(RunAfters.java:33) at org.junit.runners.ParentRunner.run(ParentRunner.java:363) at cucumber.api.junit.Cucumber.run(Cucumber.java:100) at org.junit.runner.JUnitCore.run(JUnitCore.java:137) at com.intellij.junit4.JUnit4IdeaTestRunner.startRunnerWithArgs(JUnit4IdeaTestRunner.java:68) at com.intellij.rt.execution.junit.IdeaTestRunner$Repeater.startRunnerWithArgs(IdeaTestRunner.java:47) at com.intellij.rt.execution.junit.JUnitStarter.prepareStreamsAndStart(JUnitStarter.java:242) at com.intellij.rt.execution.junit.JUnitStarter.main(JUnitStarter.java:70) 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:4133) at com.fasterxml.jackson.databind.ObjectMapper._readMapAndClose(ObjectMapper.java:3988) at com.fasterxml.jackson.databind.ObjectMapper.readValue(ObjectMapper.java:3037) at net.masterthought.cucumber.ReportParser.parseForFeature(ReportParser.java:84) ... 18 more
json [ { "line": 1, "elements": [ { "before": [ { "result": { "duration": 8012137757, "status": "passed" }, "match": { "location": "Test.Initialization()" } } ], "line": 9, "name": "Login to app with different credentials", "description": "", "id": "login-feature;login-to-app-with-different-credentials;;2", "type": "scenario", "keyword": "Scenario Outline", "steps": [ { "result": { "duration": 1788013363, "status": "passed" }, "line": 4, "name": "I enter admin and admin", "match": { "arguments": [ { "val": "admin", "offset": 8 }, { "val": "admin", "offset": 18 } ], "location": "LoginSteps.iEnterUsernameAndPassword(String,String)" }, "matchedColumns": [ 0, 1 ], "keyword": "Given " }, { "result": { "duration": 141369644, "status": "passed" }, "line": 5, "name": "home page displays", "match": { "location": "LoginSteps.homePageDisplays()" }, "keyword": "And " } ] } ], "name": "Login Feature", "description": "", "id": "login-feature", "keyword": "Feature", "uri": "Login.feature" } ]
build.gradle
plugins { id 'java' }
group 'com.abc' version '1.0-SNAPSHOT'
sourceCompatibility = 1.8
repositories { maven { url 'http://repo1.maven.org/maven2' } }
repositories { jcenter() mavenCentral() }
dependencies { testCompile group: 'junit', name: 'junit', version: '4.12' compile group: 'org.seleniumhq.selenium', name: 'selenium-java', version: '3.12.0' compile group: 'org.seleniumhq.selenium', name: 'selenium-support', version: '3.12.0' compile group: 'io.github.bonigarcia', name: 'webdrivermanager', version: '2.2.1' compile group: 'info.cukes', name: 'cucumber-core', version: '1.2.5' compile group: 'info.cukes', name: 'cucumber-java', version: '1.2.5' testCompile group: 'info.cukes', name: 'cucumber-junit', version: '1.2.5' compile group: 'info.cukes', name: 'cucumber-jvm', version: '1.2.5', ext: 'pom' compile group: 'net.masterthought', name: 'cucumber-reporting', version: '3.7.0' compile group: 'org.json', name: 'json', version: '20180130' compile group: 'com.fasterxml.jackson.core', name: 'jackson-core', version: '2.9.6' testCompile group: 'io.rest-assured', name: 'rest-assured', version: '3.1.0' compile group: 'javax.enterprise', name: 'cdi-api', version: '2.0' }
Runnerclass:
@RunWith(Cucumber.class) @CucumberOptions( plugin = { "json:target/cucumber-json-report.json"} , features = {"src/test/resources/features"} , glue = {"classpath:"} , strict = true , dryRun = false, monochrome = true, snippets = SnippetType.CAMELCASE )
public class TestRunner { @AfterClass public static void generateReports() {