Comments (9)
Well, I personally do not use any other formats, so there are no plans for such from my point of view. but if a contribution is made for such a format, then it can be accepted. you may also write a package with this format and register it as godog.Format by following a sample like junit
from godog.
I have started doing exactly what you have suggested. Hopefully you will see a PR soon. Thank you for the quick response.
from godog.
OK then, thanks
from godog.
I have been looking at a cucumber example at https://www.relishapp.com/cucumber/cucumber/docs/formatters/json-output-formatter. The sample ruby step definitions show two commands "embed" and "put" which cucumber understands and writes to the test output file.
Examples:
embed "screenshot.png", "image/png"
puts "from step definition"
Does godog support these? I dont think I see these supported but wanted to confirm first. I they are not then I can ignore them for now in the cucumber formatter.
from godog.
currently not supported in godog.
from godog.
Before I get too far down my testing and then find you dont like the approach. I have created a feature file to test the cucumber formatting. I leveraged two existing steps in suite_test.go and created one additional whose purpose is to validate the json output.
To validate the json I chose to put the expected json string as a docstring vs creating steps to validate json fields independently. The docstring approach seemed to make it easy. I generated the docstring by running a ruby cucumber and getting the json output for the same gherkin that I have defined in the "Given" step.
Is this approach good for you? Or do you have some other recommendation?
formatter/cucumber.feature:
Feature: cucumber json formatter
In order to support tools that import cucumber json output
I need to be able to support cucumber json formatted output
Scenario: Support of Feature Plus Scenario Node
Given a feature "features/simple.feature" file:
"""
Feature: simple feature
simple description
Scenario: simple scenario
simple feature description
"""
When I run feature suite with formatter "cucumber"
Then the rendered json will be as follows:
""" application/json
[
{
"uri": "features/simple.feature",
"id": "simple-feature",
"keyword": "Feature",
"name": "simple feature",
"description": " simple description",
"line": 1,
"elements": [
{
"id": "simple-feature;simple-scenario",
"keyword": "Scenario",
"name": "simple scenario",
"description": " simple feature description",
"line": 3,
"type": "scenario"
}
]
}
]
"""
from godog.
Hi @ckstettler yes that makes sense, I would have done it the same way. Thanks for asking to confirm, good work!
from godog.
One other knit I found that the godog data model seems to only have comments at the Feature level. I was not able to see comments attached to Scenarios or Step data structures. I dont see this as a major issue but it was different that cucumber unless I am missing something...
Also regarding the docstring, is step.Argument always a nil value or *gherkin.Docstring? Or can it be of other types? I put logic to test to see if it was a docstring but wasnt sure if that was necessary. I am probably safer checking the assertion status regardless, however, I am curious?
I think the code is complete. I need to do an internal review on my side to get approval to submit it, but it should be in the next day or two.
from godog.
godog is shipping gherkin package together, but it acts as vendor package, currently packaged with gherkin v3. even the master branch, does not support the comments in gherkin, see scenario def.
Arguments can be:
- any golang primitive
- *DocString
- *DataTable
Maybe you could add a comment somewhere in the code (where you mentioned embedded error details like images or stack traces) this may be added to godog later, as it might have a different type of error which could support context.
from godog.
Related Issues (20)
- Support for Go 1.20
- runAfterScenarioHooks invoke twice when step failed that is not the last step HOT 4
- Enhancement to allow to skip a test from the code HOT 8
- Background Outline HOT 2
- Setting option `Concurrency = 2` fails when running the Example HOT 1
- click on run tests but tests are not running HOT 1
- Please update the concurrency paragraph in the docs to clarify if scenario outlines run in parallel or only the scenarios HOT 1
- Is this feature file in godog/_examples/godogs running sequencially ? HOT 2
- Why Getting total scenarios as 6 while I am having total 5 scenarios HOT 3
- Skipping a test by returning `godog.ErrSkip` does not work? HOT 4
- print error stack when panic
- step function support return a nil Context with error HOT 1
- Conflict between global flags set by godog.BindCommandLineFlags and spf13/cobra HOT 1
- HELP: I want to know the index of a scenario in a scenario outline in the before scenario hook.
- Can't navigate to step definition from Gherkin step
- Unexpected step line values in cucumber report generated by Godog for scenario outlines
- ReadMe add step `go get ...` see provided patch to fix it
- Tag Filtering Expressions HOT 2
- Calculated step duration is wrong HOT 3
- Support for attachments / embeddings as per Cucumber and Behave HOT 9
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from godog.