Closed baernhaut closed 6 years ago
Show me that JSON file first.
There it is. I've done some more research, and I've seen that in maven projects there is the maven-cucumber-reporting artifact, which can be executed in this form:
- < executions> -< execution> < id>execution< /id> < phase>verify< /phase> -< goals> < goal>generate< /goal> < /goals> -< configuration> < projectName>Testing< /projectName> < outputDirectory>${project.build.directory}/site/cucumber-reports< /outputDirectory> < cucumberOutput>${project.build.directory}/site/cucumber-reports-json/< /cucumberOutput> < buildNumber>${project.version}< /buildNumber> < /configuration> < /execution> < /executions>
Is there a way to accomblish the same in gradle?
[ { "comments": [ { "line": 1, "value": "#language:de" }, { "line": 2, "value": "## RDNG: comment1" }, { "line": 3, "value": "## RQM: comment2" }, { "line": 4, "value": "##" }, { "line": 5, "value": "## notes" }, { "line": 6, "value": "## - note1" }, { "line": 7, "value": "## - note2" }, { "line": 8, "value": "##" } ], "line": 10, "elements": [ { "line": 12, "name": "", "description": "", "type": "background", "keyword": "Grundlage" }, { "line": 53, "name": "01 - scenarioname", "description": "\r\ comment", "type": "scenario", "keyword": "Szenariogrundriss", "steps": [ { "result": { "duration": 19103752096, "status": "passed" }, "line": 23, "name": "step1 "", "match": { "arguments": [ { "val": "value1", "offset": 28 } ], "location": "SetupGlueCode.method1()" }, "matchedColumns": [ 4 ], "keyword": "Angenommen " }, { "result": { "duration": 389094606, "status": "passed" }, "line": 24, "name": "step2", "match": { "arguments": [ { "val": "value2", "offset": 37 } ], "location": "SetupGlueCode.method2(String)" }, "keyword": "Und " }, { "result": { "duration": 1613708007, "error_message": "org.junit.ComparisonFailure: exception message. ", "status": "failed" }, "line": 25, "name": "step3"", "match": { "arguments": [ { "val": "value3", "offset": 26 } ], "location": "method3()" }, "keyword": "Und " }, { "result": { "status": "skipped" }, "line": 27, "name": "step4"", "match": { "arguments": [ { "val": "value", "offset": 42 }, { "val": "value", "offset": 63 }, { "val": "value", "offset": 84 } ], "location": "method4(String,String,String)" }, "keyword": "Und " }, { "result": { "status": "skipped" }, "line": 29, "name": "step5", "match": { "arguments": [ { "val": "value", "offset": 22 } ], "location": "method5()" }, "keyword": "Angenommen " }, { "result": { "status": "skipped" }, "line": 30, "name": "step6", "match": { "arguments": [ { "val": "value6", "offset": 36 } ], "location": "method6()" }, "keyword": "Dann " }, { "result": { "status": "skipped" }, "line": 32, "name": "step7", "match": { "arguments": [ { "val": "100,00", "offset": 26 } ], "location": "method7(String)" }, "matchedColumns": [ 0 ], "keyword": "Wenn " }, { "result": { "status": "skipped" }, "line": 33, "name": "step8", "match": { "arguments": [ { "val": "value8", "offset": 15 } ], "location": "method8(String)" }, "matchedColumns": [ 2 ], "keyword": "Und " }, { "result": { "status": "skipped" }, "line": 34, "name": "step9", "match": { "arguments": [ { "val": "value9", "offset": 12 } ], "location": "method9(String)" }, "matchedColumns": [ 1 ], "keyword": "Und " }, { "result": { "status": "skipped" }, "line": 36, "name": "step10", "match": { "arguments": [ { "val": "value", "offset": 48 } ], "location": "method10(String)" }, "keyword": "Dann " }, { "result": { "status": "skipped" }, "line": 38, "name": "step11", "match": { "arguments": [ { "val": "value", "offset": 5 } ], "location": "method11(String)" }, "matchedColumns": [ 3 ], "keyword": "Wenn " }, { "result": { "status": "skipped" }, "line": 39, "name": "step12", "match": { "arguments": [ { "val": "value12", "offset": 16 } ], "location": "method12" }, "matchedColumns": [ 0, 1, 2, 3 ], "rows": [ { "cells": [ "value", "100,00" ], "line": 40 }, { "cells": [ "value", "value-value" ], "line": 41 }, { "cells": [ "value", "value-value" ], "line": 42 }, { "cells": [ "value", "value-value" ], "line": 43 } ], "keyword": "Dann " }, { "result": { "status": "skipped" }, "line": 45, "name": "step13", "match": { "location": "method13()" }, "keyword": "Wenn " }, { "result": { "status": "skipped" }, "line": 46, "name": "step14", "match": { "arguments": [ { "val": "value14", "offset": 25 } ], "location": "method14" }, "keyword": "Dann " }, { "result": { "status": "skipped" }, "line": 47, "name": "step15", "match": { "arguments": [ { "val": "value", "offset": 15 }, { "val": "100,00", "offset": 38 }, { "val": "value", "offset": 52 } ], "location": "method15()" }, "matchedColumns": [ 0 ], "keyword": "Und " }, { "result": { "status": "skipped" }, "line": 48, "name": "step16", "match": { "arguments": [ { "val": "value", "offset": 15 }, { "val": "100,00", "offset": 43 }, { "val": "value", "offset": 57 } ], "location": "method16()" }, "matchedColumns": [ 0 ], "keyword": "Und " }, { "result": { "status": "skipped" }, "line": 49, "name": "step17", "match": { "arguments": [ { "val": "value", "offset": 15 }, { "val": "value", "offset": 34 } ], "location": "method17()" }, "keyword": "Und " } ], "tags": [ { "line": 9, "name": "@UI-Tested" }, { "line": 14, "name": "@presentation" }, { "line": 9, "name": "@tag1" }, { "line": 9, "name": "@tag2" } ] } ], "name": "Test_name", "description": "", "id": "test_id", "keyword": "Funktionalität", "uri": "feature.feature", "tags": [ { "line": 9, "name": "@UI-Tested" }, { "line": 9, "name": "@tag1" }, { "line": 9, "name": "@tag2" } ] } ]
Guys, this is not even correct JSON file (so it could not be a cucumber as well)!
Hello, I've read the two issues regarding this Exception.
Somehow mine is a little bit different: I checked if the encoding is correct and the JSON File is encoded in UTF-8. So that should be fine.
The thing is, when I run my tests and call the ReportBuilder on the JSON-File currently generated, i get this Exception. If I run the test and generate a Report of the json file from a prior Run, there is no problem.
So I guess my program is not done generating the JSON file? I'm calling the ReportGenerator in @AfterClass in my Runnerclass. Also tried to apply it in @After (cucumber) in my stepdefinition of the scenario.
Full exception:
I'm not attaching a JSON File, because it is working, if I call an older ( even the run before) JSON-file, when i start a new Run.
here's my runnerClass: `@RunWith(Cucumber.class) @CucumberOptions(features = "src/test/resources/regr", glue = { "path_to_gluecode" }, tags = { "@presentation" }, plugin = {"pretty", "json:cucumber-json-report.json"}, monochrome = true) public class RunAllCucumberTests {
Thanks a lot.