common icon indicating copy to clipboard operation
common copied to clipboard

Emit messages that link AST nodes to results

Open vincent-psarga opened this issue 3 years ago • 2 comments

Summary

HTML report are really heavy as they embed the whole messages stream. We can reduce the messages by pre-computing results data:

  • result
  • duration
  • timestamp
  • attachments

Once this is done, we would only need the gherkinDocument messages to render the HTML report and a new data structure to represent pre-computed results (linking results directly to AST node (feature, scenario, exampleRow, step)

Expected Behavior

The reports overall size should be reduced. One step further could also be to extract the attachments content for images, videos and other HTML embeddable content)

Possible Solution

  • port the following libraries to the other languages: gherkin-utils, query
  • share test suites

Context & Motivation

  • reduce file size of static HTML reports
  • reduce load time for Cucumber Reports

vincent-psarga avatar Apr 07 '21 10:04 vincent-psarga

I think this is a great idea! 🌟🌟🌟🌟🌟

I'd suggest changing the description of this ticket to something like "link back to AST nodes in test result messages" - that would seem to better fit the way @aslakhellesoy described this idea to me, and better explain the benefits. Smaller file sizes is one benefit, but there are others too, such as making it simpler for people to build formatters / reporters on top of the protocol.

mattwynne avatar Apr 08 '21 17:04 mattwynne

Idea:

  • Final message stream does not include messages only used by Cucumber's execution
    • Pickles
    • etc

We can add an extra property to the TestStepFinished message. Something like this...

type TestStepFinished = {
   documentStepReferences: DocumentStepReference[]
}

type DocumentStepReference = {
  astNodeId: string
  uri: string
  lineNumber: number
}

By denormalising this way, consuming messages becomes a lot easier, and we can probably scrap the Query module altogether.

aslakhellesoy avatar Apr 20 '21 16:04 aslakhellesoy