2
votes

For example, I have a list of ids for a product that lives in a database and is updated daily. I need to be able to run a scenario that consumes that data and runs the same steps over each of the ids in order. However, the test should not stop because one of the ids failed in the scenario, similar to what cucumber does with the scenario outline type of tests.

We would also want to format the output of the cucumber test(s) so that each id is formatted as if it is a separate test or example in a "scenario outline."

2
What behavior are you trying to prove, that the system handles a variety of data or that the data in the database is good? Either of those can be done without changing the intent of cucumber. - Dave McNulla
Dave, I am trying to run the same scenario, once fore each id that we get from the database. We want to test some functionality of the website described with that id but we don't want to stop testing if one of the ids causes a step to fail. - wpickett
Cucumber proves behavior. When I design scenarios, I start with no data, then I load the data that I want for my scenario. That data is designed to prove something. If I want to prove really long category names, I will load categories with long names. If I want to prove pagnation, I'll load more categories than fit on a page. If I am trying to make sure that all categories can be opened, then I don't use cucumber for that. That's not behavior, that's content. - Dave McNulla

2 Answers

1
votes

I believe I did something similar some time ago. Have a look at this feature definition.

The "Then I should be able to get to the browse categories page" action is defined here and, as you can see, Category at line 59 retrieves data from this class. In this case I'm getting data from a CSV file, but you can just substitute it with your DB.

My Ruby is a bit basic so the code style might not look so good, but it is an example I had around to easily explain what I did. Hope this help!

-1
votes

Cucumber is not designed to write complex information in feature file , If your Data is complex , or dynamically generated , you should get Data in step definition and write a generic term in feature file .

That's the intention of cucumber , writing simple features so that non technical person can easily understand what the scenario is doing.