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

@cucumber/json-to-messages generates TestStepResult#messages as string[] for Behave #1602

Open
aslakhellesoy opened this issue Jun 9, 2021 · 0 comments

Comments

@aslakhellesoy
Copy link
Contributor

aslakhellesoy commented Jun 9, 2021

Summary

A Cucumber Reports user used @cucumber/json-to-messages to convert Behave JSON to messages. One of the messages looks like this (sensitive details edited):

{
  "testStepFinished": {
    "testCaseStartedId": "522e2d20-37f0-4296-87fe-b87069afccec",
    "testStepId": "9c3b9582-d6d2-4f55-88e7-a6d563c57df3",
    "testStepResult": {
      "willBeRetried": false,
      "duration": {
        "seconds": 0,
        "nanos": 0
      },
      "status": "FAILED",
      "message": [
        "Assertion Failed: The pattern isn't contained!!!",
        "Captured stdout:",
        "",
        "",
        "login:",
        " admin",
        "Password:",
        " ",
        "                    Bla bla bla bla                   ",
        "",
        "--------------------------------------------------------------------------------",
        "",
        "Bla bla bla",
        " bla bla"
      ]
    },
    "timestamp": {
      "seconds": 1623180174,
      "nanos": 354000000
    }
  }
}

Expected Behavior

The message field should be a string (with newlines)

Current Behavior

The message field is a string array

Possible Solution

Analyse the output from Behave and determine if the JSON output contains string arrays. If it does, join the string array with \n before setting the message field.

We should also perform JSON schema validation of the generated messages in the same way as we now do for the CCK.
See

acceptance/%.ndjson.valid: features/%.ndjson
mkdir -p $(@D)
cat $< | ../../node_modules/.bin/ts-node src/validate.ts > $@

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

1 participant