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

Inaccurate output of retried scenarios #4

Open
badeball opened this issue May 10, 2022 · 0 comments
Open

Inaccurate output of retried scenarios #4

badeball opened this issue May 10, 2022 · 0 comments

Comments

@badeball
Copy link
Member

badeball commented May 10, 2022

πŸ‘“ What did you see?

There's a difference in outputted JSON from cucumber-js compared to its messages piped through cucumber-json-formatter.

βœ… What did you expect to see?

The JSON output of cucumber-js in case of a scenario passing on 2nd attempt.

[
  {
    "description": "",
    "elements": [
      {
        "description": "",
        "id": "a-feature;a-scenario",
        "keyword": "Scenario",
        "line": 2,
        "name": "a scenario",
        "steps": [
          {
            "arguments": [],
            "keyword": "Given ",
            "line": 3,
            "name": "a step",
            "match": {
              "location": "features/definitions.js:5"
            },
            "result": {
              "status": "passed",
              "duration": 0
            }
          }
        ],
        "tags": [],
        "type": "scenario"
      }
    ],
    "id": "a-feature",
    "line": 1,
    "keyword": "Feature",
    "name": "a feature",
    "tags": [],
    "uri": "features/foo.feature"
  }
]

However, when piping the messages output through cucumber-json-formatter I get the following.

[
  {
    "description": "",
    "elements": [
      {
        "description": "",
        "id": "a-feature;a-scenario",
        "keyword": "Scenario",
        "line": 2,
        "name": "a scenario",
        "steps": [
          {
            "keyword": "Given ",
            "line": 3,
            "name": "a step",
            "result": {
              "duration": 2000000,
              "status": "failed",
              "error_message": "Error: YOLO!\n    at World.\u003canonymous\u003e (/home/jonas/projects/json-report-examples/retried-test/features/definitions.js:9:11)"
            },
            "match": {
              "location": "features/definitions.js:5"
            }
          }
        ],
        "type": "scenario"
      },
      {
        "description": "",
        "id": "a-feature;a-scenario",
        "keyword": "Scenario",
        "line": 2,
        "name": "a scenario",
        "steps": [
          {
            "keyword": "Given ",
            "line": 3,
            "name": "a step",
            "result": {
              "status": "passed"
            },
            "match": {
              "location": "features/definitions.js:5"
            }
          }
        ],
        "type": "scenario"
      }
    ],
    "id": "a-feature",
    "keyword": "Feature",
    "line": 1,
    "name": "a feature",
    "uri": "features/foo.feature"
  }
]

Notice the diff (using json-diff).

 [
   {
-    tags: [
-    ]
     elements: [
       {
-        tags: [
-        ]
         steps: [
           {
-            arguments: [
-            ]
             result: {
+              error_message: "Error: YOLO!\n    at World.<anonymous> (/home/jonas/projects/json-report-examples/retried-test/features/definitions.js:9:11)"
-              status: "passed"
+              status: "failed"
-              duration: 0
+              duration: 2000000
             }
           }
         ]
       }
+      {
+        id: "a-feature;a-scenario"
+        keyword: "Scenario"
+        line: 2
+        name: "a scenario"
+        steps: [
+          {
+            keyword: "Given "
+            line: 3
+            name: "a step"
+            result: {
+              status: "passed"
+            }
+            match: {
+              location: "features/definitions.js:5"
+            }
+          }
+        ]
+        type: "scenario"
+      }
     ]
   }
 ]

πŸ“¦ Which tool/library version are you using?

  • cucumber-js: 8.1.2
  • cucumber-json-formatter: 19.0.0

πŸ”¬ How could we reproduce it?

Steps to reproduce the behavior:

  1. git clone https://github.com/badeball/reproducible-issues.git
  2. cd reproducible-issues/cucumber/retried-scenario
  3. npx @cucumber/cucumber
  4. npx json-diff report.json <(cat report.ndjson | cucumber-json-formatter)
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

1 participant