How do we handle minor permutations of BDD scenarios?

拟墨画扇 提交于 2019-12-04 05:28:13

My rule for BDD is that the developers should easily be able to derive the scenarios from whatever behavior is described, and if they can't, illustrate the behavior with scenarios.

BDD is at its most useful when it's describing things that are tricky; either when passing expert knowledge to the developers, or narrowing down behavior until uncertainty is discovered. In a CRUD application with basic filters, behavior is really easy to understand.

What you're describing is probably best covered Dan North's "Ginger Cake" pattern: take the recipe for something else, but with one aspect of behavior different from another (or in this case with one additional, easy-to-understand aspect of behavior). He also uses copy-paste a bit, and I suspect particularly for this kind of behavior.

So, your inclination is perfectly correct. If automating, I'd probably automate just one example and let unit and integration tests cover the rest.

I'd also want to know why this project was being pursued. There has to be something interesting about it, or it wouldn't be happening. Find that, and it's probably a great place to start discussing scenarios.

If you're refactoring scenarios, usually by extracting little tables from duplicate scripts, then the maintenance cost likely won't hurt you at all. This doesn't solve the problem of the execution time cost, though.

In such a situation, I'd probably suggest automating both the simplest scenario (no customers) and the most complicated (many customers matching a filter, but not all), and leave the other permutations to more focused programmer tests. I would include the "no customers" case only because people have a tendency to get that one horribly wrong, as in occasionally crashing the program. (You didn't run the seed data script?!)

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!