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

Added GetGherkinFeatures method to godog.Suite #276

Merged
merged 1 commit into from
Jul 19, 2021

Conversation

radtriste
Copy link
Contributor

And created interface GherkinFeature to allow to retrieve the main Gherkin information.

#222

Following #223 and migration to new Gherkin structure.

@codecov
Copy link

codecov bot commented Mar 25, 2020

Codecov Report

Merging #276 (20ab6fc) into main (3de6fb0) will increase coverage by 1.89%.
The diff coverage is 100.00%.

❗ Current head 20ab6fc differs from pull request most recent head 5566c15. Consider uploading reports for the commit 5566c15 to get more accurate results
Impacted file tree graph

@@            Coverage Diff             @@
##             main     #276      +/-   ##
==========================================
+ Coverage   82.30%   84.19%   +1.89%     
==========================================
  Files          26       16      -10     
  Lines        2368     2468     +100     
==========================================
+ Hits         1949     2078     +129     
+ Misses        309      271      -38     
- Partials      110      119       +9     
Impacted Files Coverage Δ
suite.go 87.91% <100.00%> (-2.82%) ⬇️
fmt.go 94.40% <0.00%> (-5.60%) ⬇️
run.go 79.33% <0.00%> (-4.47%) ⬇️
internal/formatters/fmt_junit.go
internal/flags/flags.go
internal/formatters/fmt_progress.go
internal/formatters/fmt_multi.go
internal/models/feature.go
formatters/fmt.go
... and 28 more

Continue to review full report at Codecov.

Legend - Click here to learn more
Δ = absolute <relative> (impact), ø = not affected, ? = missing data
Powered by Codecov. Last update 3de6fb0...5566c15. Read the comment docs.

@radtriste radtriste marked this pull request as ready for review March 25, 2020 17:30
suite.go Outdated
@@ -248,6 +264,16 @@ func (s *Suite) Step(expr interface{}, stepFunc interface{}) {
s.steps = append(s.steps, def)
}

// GetGherkinFeatures returns parsed Gherkin features for the suite
// It can be useful to retrieve some information about Gehrkin document, Pickles ...
func (s *Suite) GetGherkinFeatures() []GherkinFeature {
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

What do you think about instead of this function returning interfaces, it would return structs which includes the GherkinDocument and the Pickles?

I'm not too happy about returning pointers, sense that would mean that the test could modify the data, I would like to keep potential side effects to a minimum.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Sometimes the developer writing the tests may want to modify some data before the test. This interface way would be a good way to give this possiblity. As it stays in the suite, it would be done before the whole testing.
Or would it make to much side effects ?

But I can change the GherkinFeature to a struct instead right with 2 attributes for pickles and gherkindocument

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Shouldn't it be better to make the interface but add some explicit way to modify data so we can assume the developer now what he is doing if something break ?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I would say it is a bit too much, and would add more maintenance ...
but a comment on the interface warning about modifications could do or ?
@lonnblad what do you think ?

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM. @lonnblad ?

@lonnblad
Copy link
Member

@radtriste thanks for the PR, it would be good to get some tests for this as well

@radtriste
Copy link
Contributor Author

That I will write :)

@radtriste
Copy link
Contributor Author

@lonnblad is that what you meant ? (see my changes)

@radtriste
Copy link
Contributor Author

any news on that one ?

@mattwynne
Copy link
Member

@radtriste so sorry for the delay getting this merged. Would you be able to help rebase it, then we can get it merged in?

@radtriste
Copy link
Contributor Author

@mattwynne sure will try to rebase in the next days !

@radtriste radtriste force-pushed the issue_222 branch 2 times, most recently from c483a0f to 50a949b Compare July 13, 2021 12:55
@radtriste
Copy link
Contributor Author

@mattwynne @lonnblad let me know what you think of the change.
I directly setup a method on the Test Suite to retrieve the features.
This method is independent from the Run and should not have any impact on it

@mattwynne mattwynne merged commit 48c0e0d into cucumber:main Jul 19, 2021
@aslakhellesoy
Copy link
Contributor

Hi @radtriste,

Thanks for your making your first contribution to Cucumber, and welcome to the Cucumber committers team! You can now push directly to this repo and all other repos under the cucumber organization! 🍾

In return for this generous offer we hope you will:

  • ✅ Continue to use branches and pull requests. When someone on the core team approves a pull request (yours or someone else's), you're welcome to merge it yourself.
  • 💚 Commit to setting a good example by following and upholding our code of conduct in your interactions with other collaborators and users.
  • 💬 Join the community Slack channel to meet the rest of the team and make yourself at home.
  • ℹ️ Don't feel obliged to help, just do what you can if you have the time and the energy.
  • 🙋 Ask if you need anything. We're looking for feedback about how to make the project more welcoming, so please tell us!

On behalf of the Cucumber core team,
Aslak Hellesøy
Creator of Cucumber

@mattwynne
Copy link
Member

Thanks @radtriste. I've merged your PR without a very thorough review as we're short on regular maintainers at the moment. Now that you have the commit bit 🎉 it would be awesome if you had any time to help us with that problem. No pressure! ❤️

@radtriste radtriste deleted the issue_222 branch July 20, 2021 07:46
@radtriste
Copy link
Contributor Author

@mattwynne Cannot promise anything but can keep an eye on godog project for now

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

Successfully merging this pull request may close these issues.

None yet

5 participants