zerocode icon indicating copy to clipboard operation
zerocode copied to clipboard

Github damianszczepanik cucumber-reporting integration poc

Open authorjapps opened this issue 5 years ago • 6 comments

From twitter: https://twitter.com/bbrannic/status/1077892960426041344

The following repo has a good reporting solution which expects the test-run results in JSON format https://github.com/damianszczepanik/cucumber-reporting

Zerocode already produces test-run results in JSON format. Some subset of data from this is used for CSV reporting and some for HTML reporting.

Currently it uses extent-reporting for drawing aggregates, search/filter, fuzzy text matching etc

<dependency>
    <groupId>net.masterthought</groupId>
    <artifactId>cucumber-reporting</artifactId>
    <version>(check version above)</version>
</dependency>

TODO- (ACs)

  1. Can anyone pick this as a POC to see if we have all the data available for drawing the cucumber-reporting HTML graph ?

  2. Figure out if there are any optional and mandatory firlds in the cucumber-reporting drawing.

  3. If we have all the necessary fields available in the raw JSON, then draw a sample report and attach it to this ticket or your own repo e.g. sample

  4. Also verify the responsiveness of the drawn report for sanity only(optional)

Reference

  • Background section has this. Please visit this page.

  • The "Usage" section has code samples how to integrate. https://github.com/damianszczepanik/cucumber-reporting#usage

Please reachout to the collaborators/authors @damianszczepanik for any low lavel details as and when needed.

authorjapps avatar Feb 28 '19 06:02 authorjapps

Do you need help with this one, @authorjapps?

jaoseguera avatar Apr 02 '19 15:04 jaoseguera

Yes please, Thank you 👍 The below info might be helpful for proceeding with the ticket.

e.g. When you run any test project using Zerocode, it generates the raw reports into the following folder

/target/zerocode-test-reports

You can simply clone the HelloWorld repo and do a mvn clean install. You will find lot of these reports generated per test case wise into the above folder.

You can pick any .json file and see what all fields can be mapped to the cucumber report generation.

Then you can fork the Zerocode source code, and do the changes.

Happy to help further if you need us to!

authorjapps avatar Apr 02 '19 16:04 authorjapps

Hi, I have started to compare sample cucumber.json and zerocode json zerocode json

{
  "timeStamp":"2019-08-13T23:25:59.276",
  "results":[
    {
      "scenarioName":"GIVEN- the GitHub REST end point, WHEN- I invoke GET, THEN- I will receive the 200 status with body",
      "steps":[
        {
          "name":"get_user_details",
          "url":"https://api.github.com/users/octocat",
          "correlationId":"3aaa0509-c6a7-46f1-9026-ad3e46dd4c15",
          "operation":"GET",
          "requestTimeStamp":"2019-08-13T23:25:59.317",
          "responseTimeStamp":"2019-08-13T23:26:00.124",
          "responseDelay":807.0,
          "result":"PASSED",
          "assertions":"{\n  \"status\" : 200,\n  \"body\" : {\n    \"login\" : \"octocat\",\n    \"id\" : 583231,\n    \"type\" : \"User\"\n  }\n}"
        }
      ],
      "loop":0
    }
  ]
}

cucumber json

[
  {
    "line": 1,
    "elements": [
      {
        "start_timestamp": "2019-08-14T18:00:42.630Z",
        "line": 3,
        "name": "a few cukes",
        "description": "",
        "id": "belly;a-few-cukes",
        "type": "scenario",
        "keyword": "Scenario",
        "steps": [
          {
            "result": {
              "duration": 537153,
              "status": "passed"
            },
            "line": 4,
            "name": "I have 42 cukes in my belly",
            "match": {
              "arguments": [
                {
                  "val": "42",
                  "offset": 7
                }
              ],
              "location": "Stepdefs.I_have_cukes_in_my_belly(int)"
            },
            "keyword": "Given "
          },
          {
            "result": {
              "duration": 46689,
              "status": "passed"
            },
            "line": 5,
            "name": "I wait 1 hour",
            "match": {
              "arguments": [
                {
                  "val": "1",
                  "offset": 7
                }
              ],
              "location": "Stepdefs.i_wait_hour(Integer)"
            },
            "keyword": "When "
          },
          {
            "result": {
              "duration": 19006,
              "status": "passed"
            },
            "line": 6,
            "name": "my belly should growl",
            "match": {
              "location": "Stepdefs.my_belly_should_growl()"
            },
            "keyword": "Then "
          }
        ]
      }
    ],
    "name": "Belly",
    "description": "",
    "id": "belly",
    "keyword": "Feature",
    "uri": "classpath:io/cucumber/skeleton/belly.feature",
    "tags": []
  }
]

1)Feature: Belly 2) 3) Scenario: a few cukes 4) Given I have 42 cukes in my belly 5) When I wait 1 hour 6) Then my belly should growl

gangadhargo avatar Aug 14 '19 18:08 gangadhargo

I am not able to parse zerocode json using cucmber reporting it is throwing invalid json exception

To create same like cucumber json.. feature,scenario, steps are mandatory and how we calcuate duration for each step

Any suggestions please on how to implement and proceed, I want to contribute to the project

Thanks, Gangadhar.

gangadhargo avatar Aug 14 '19 18:08 gangadhargo

Anyone working on this. I will like to contribute

agbanagba avatar Aug 21 '19 22:08 agbanagba

is this issue Resolved?

AkshayBabbar avatar Feb 02 '20 14:02 AkshayBabbar