-
Notifications
You must be signed in to change notification settings - Fork 253
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
Make Suite.runSteps
Method public
#167
Comments
Hi, could you explain what is the context you are using godog with? Godog uses godog to test itself, since I see you build steps to run feature files, maybe godog.SuiteContext is the more appropriate tool for such case, and instead you could contribute to that context which you can reuse. It has all kinds of steps in order to run feature files and make related assertions. I want to be aware of reasoning for such changes, since that relates to public interface of godog which will need to be maintained |
Hey @l3pp4rd thanks for your reply! In my situation I want to address certain features scenarios from another feature that tests an app update. so basically I want to be able to comfortably select certain scenarios (as portions from the normal tests) to make sure they pass in the context of a recently updated service. So I would parse the respective feature file, run the steps of its background and then insert my update step before I proceed to the selected scenario. I know this is a very special use case but I`m sure others exist in more complex scenarios. In our case this change helps keeping the feature files relatively short and expressive with good reuse of gherkin scenarios. Thanks for the hint to With the Anyways I appreciate any help in getting the desired behaviour and understand your concerns regarding the api change. thanks for this great tool! |
I'll need to postpone such change, it requires more thinking. at the moment, run step fires all events to formatters and that may cause unexpected behavior, like for example, since these steps may be created dynamically, they are not related to any feature file and that is not an expected behavior godog may deal with including everyone using it. So far I do not think that I can accept such a change, concerning nested steps, they will be removed since that has too many flaws. I would suggest just to have some kind of a workaround for now. For example just combining that code logic from steps you are executing into a normal function and hitting it whenever reasonable from the step. |
I understand your reasoning and will find another solution for my use case. However I hope you don't (although I understood here you do) plan to remove the For example one very important step in my ensemble is: Background:
And the following steps run once for this feature:
"""
# expensive setup
I reset the database
I do other expensive
""" |
Hey @ziprandom, Thanks so much for taking the time to propose this idea and to submit a PR around it. As l3pp4rd mentioned, nested steps are considered an anti-pattern and will be removed. While your particular use-case isn't -exactly- that, it feels very close. Since Gherkin is meant to be a declarative representation of a feature's behavior, things like Again to echo l3pp4rd's comment, one of the recommended ways to handle setup is via helper functions paired with a more declarative Given step. I think the comments added by mpkorstanje and luke-hill on the following issue are very applicable to your particular use case. Please give it a read and see if you're able to use any of the guidance to improve your setup/glue code. Thank you again for taking the time to describe your use-case and provide a PR supporting it, however I'm going to close this issue and the PR. If you have any questions, feel free to reach out. |
I'm using godog in a complex system testing scenario and would really like to more flexibly reuse parts of my feature files. I have been using the multistep feature but think it could be replaced by this functionality as it reuses the Suite to run gherkin scenarios which can be parsed from external files or
gherkin.DocString
without the restrictions onDatatable
s orDocString
s as arguments metioned here #89The text was updated successfully, but these errors were encountered: