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

Support rule keyword #441

Closed
wants to merge 2 commits into from
Closed

Conversation

michaelsauter
Copy link

Related to #440.

After reading a bit more in the code I realized my original understanding of how it worked was wrong. Supporting Rule might not be that hard after all. I started implementing it a little. This is nowhere near finished though ...

@michaelsauter michaelsauter changed the title WIP Support rule keyword Nov 16, 2021
@mxygem
Copy link
Member

mxygem commented Nov 16, 2021

@michaelsauter - Thanks for running with this!

@mattwynne
Copy link
Member

Awesome @michaelsauter and thanks for doing your work in public!

Let me know if you want to do some pairing ⚡ you can book a slot with me here.

@michaelsauter
Copy link
Author

Thanks!

Sorry I did not get to it again, but I should find some time in a couple of days. Will update here and might come back to your offer of pairing!

Note that rules are not indented as that would complicate the logic considerably: every print directive would need to check if it is surrounded by a rule or not.
@michaelsauter
Copy link
Author

michaelsauter commented Dec 1, 2021

@mxygem @mattwynne Alright, I finally had the time to work a bit on this. It's now at a state where at least the pretty format seems to work well. I have added some tests that demonstrate the behaviour. I would love to hear some feedback, and if this is still missing anything.

One thing to call out maybe ... rules are not indented so far as that would complicate the logic considerably: every print directive would need to check if it is surrounded by a rule or not. What are your thoughts on this?

@michaelsauter michaelsauter marked this pull request as ready for review December 1, 2021 13:15
@codecov
Copy link

codecov bot commented Dec 1, 2021

Codecov Report

Merging #441 (46bad15) into main (30de46d) will decrease coverage by 1.43%.
The diff coverage is 6.97%.

Impacted file tree graph

@@            Coverage Diff             @@
##             main     #441      +/-   ##
==========================================
- Coverage   81.47%   80.03%   -1.44%     
==========================================
  Files          27       27              
  Lines        2186     2229      +43     
==========================================
+ Hits         1781     1784       +3     
- Misses        312      345      +33     
- Partials       93      100       +7     
Impacted Files Coverage Δ
internal/models/feature.go 51.28% <0.00%> (-48.72%) ⬇️
internal/formatters/fmt_pretty.go 74.53% <12.50%> (-6.03%) ⬇️

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 30de46d...46bad15. Read the comment docs.

@michaelsauter
Copy link
Author

I'll have another look into the code coverage when I get to it.

simple feature description

Background: simple background
Given passing step
Copy link
Member

Choose a reason for hiding this comment

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

I'm confused by this indentation - do we indent the steps by 4 characters within a Background?

Copy link
Member

Choose a reason for hiding this comment

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

Or is this about having a universal fixed indentation for every step irrespective of whether it's inside a Rule, Background, Scenario etc?

Copy link
Author

Choose a reason for hiding this comment

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

I think the indentation is actually ignored in the tests. I changed indentation and it did not caused the tests to fail.

@mattwynne
Copy link
Member

mattwynne commented Dec 3, 2021

Great work @michaelsauter. It looks like maybe we need some unit tests to cover the details of the Find* methods on feature.go to bring the coverage up. I'm surprised those aren't being picked up from the feature tests though - @vearutop are the godog feature tests included in the code coverage?

@mattwynne
Copy link
Member

One thing I wonder about might be missing, but we could do this in a separate PR, is to add support for tagging rules.

@vearutop
Copy link
Member

vearutop commented Dec 3, 2021

Yeah, feature tests are included in code coverage, apparently current tests are not triggering particular code branches.

@michaelsauter
Copy link
Author

I think there are a few more combinations that I can add to see if I can trigger those other branches. That said, I already added tests to cover some branches that were not tested before so I am a bit confused about the code coverage.

One thing I wonder about might be missing, but we could do this in a separate PR, is to add support for tagging rules.

Good point, will check how hard this is and see if I can add it to this PR.

Sorry it might be another couple of days before I get back to this ...

@azuk-bread
Copy link

@michaelsauter any updates on this one? Could really use it :)

@vearutop
Copy link
Member

If @michaelsauter does not have capacity to finish with tests and code style, I think we can merge this PR to a temporary branch and I can then add missing parts. Let's wait couple of days for response.

@michaelsauter
Copy link
Author

Sorry, I lost track of this and currently do not have a need for this. Would appreciate if you take this over. Thanks!

@vearutop vearutop self-assigned this May 20, 2022
@mattwynne
Copy link
Member

Superseded by #480. Thanks @dumpsterfireproject!

@mattwynne mattwynne closed this Jun 9, 2022
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