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

Can I decide whether the following steps should continue to execute based on the result of the previous step execution #144

Closed
lynnk1ng37 opened this issue Aug 3, 2023 · 1 comment

Comments

@lynnk1ng37
Copy link

🤔 What's the problem you're trying to solve?

As a step to create data by a way, so if this way failed, I can decide to execute the follow steps to create data by second way, just because second way has some step and DataTable to config, so I can't use try catch on script, And I want to know anyway like try catch on step define?

✨ What's your proposed solution?

eg:
Scenario: Create Create Data
Given Create data by A
Given Create data by B_step1
Given Create data by B_step2
| | | |
| | | |
Given Create data by B_step3
| | | |
| | | |
Given Create data by B_step4

to

Scenario: Create Create Data
Try Create data by A
Catch Create data by B_step1
Catch Create data by B_step2
| | | |
| | | |
Catch Create data by B_step3
| | | |
| | | |
Catch Create data by B_step4

⛏ Have you considered any alternatives or workarounds?

📚 Any additional context?


This text was originally generated from a template, then edited by hand. You can modify the template here.

@mpkorstanje
Copy link
Contributor

mpkorstanje commented Aug 10, 2023

You can store the information about the success or failure to create something in the context of your step definition. Assuming you're using Java, if you have to share state between multiple step definitions you can use DI. For example:

https://github.com/cucumber/cucumber-jvm/tree/main/cucumber-picocontainer

This is the issue tracker of an Open Source project, this not a good place to ask for help. You may be better of on Stackoverflow.

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

No branches or pull requests

2 participants