Is there a way to reuse cucumber scenarios across multiple features which each share the same UI characteristics?
For example if I am creating an iPhone app then I would have certain tests that I would like to run for each table view screen regardless of what is actually being displayed. These would be add a new row, delete a row, reorder etc.
Copying and pasting these into each feature breaks DRY. Is there a way to specify generic or templated tests in cucumber which I can include into each features that requires them?
Don’t think of BDD as testing. Think of it as providing a set of examples which show why your app is valuable and how you can use it.
If the app uses the same code for each table, all you need is one example. I would expect it to be phrased something like:
The more interesting and human you can make the scenarios, the more you’ll be able to work out why your application is valuable. That’s the real heart of BDD – not testing, but knowing why you’re writing the code in the first place.
Talking to people who really want the app will help you find out what it should do – and if you’re writing it on your own, buy a rubber duck!