cucumber / common

A home for issues that are common to multiple cucumber repositories
https://cucumber.io/docs
MIT License
3.36k stars 694 forks source link

Emit messages that link AST nodes to results #1462

Open vincent-psarga opened 3 years ago

vincent-psarga commented 3 years ago

Summary

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

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

Context & Motivation

mattwynne commented 3 years ago

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.

aslakhellesoy commented 3 years ago

Idea:

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.