I am working in a project where i need to understand gherkin parsing better than ever. Also need to implement certain higher order functionalities based on content.
I wanted to know how to convert cucumber gherkin feature files into JSON or to get it into AST Tree. I tried using Gherkin package from npm repo but i am not able to get the stream out into json with all the content. Can someone help me with an example or sample code to extract a feature step to AST or JSON format. Please help..
Thanks in advance.
According to the Gherkin documentation, you can use the Gherkin CLI to produce an AST as a JSON object. There are plenty of examples of the output and command-line parameters on their GitHub repository. Since you are parsing Gherkin, which is programming language-agnostic, you can use whichever implementation of Gherkin you prefer.