BDD, what's a feature?

痴心易碎 提交于 2019-12-10 03:03:56

问题


I'm just starting with BDD and I'm trying to build a small app, so I can see it working in a real environment, but I'm having trouble deciding what should be a feature. I'm building a tiny shop.

I decided that "Compare products" will be a feature and "User can checkout as guest" will be one, but to get to that, I first need to list products.

My question is, should "There should be a list of products" be a feature?

Thanks!


回答1:


It should probably be a feature, but try wording it from a user's point of view. What does this list of product offer him?

  • User should be able to get an overview of offered products
  • User should be able to order and reorder products on name, price, availability.



回答2:


It's pretty hard to begin doing BDD. The only thing that helps feeling confident in your abilities and the whole approach is to write test scenarios and the code that executes them. I would suggest you not to make already complex and confusing situation harder. Pick whatever task that you need to implement, open a blank text file and try to explain using simple sentences the behavior. Every sentence should start with one of three keywords: given, when and then. Using your favorite BDD framework write the code that will parse these sentences and stimulate the application to get into the start state (given), execute some commands (when) and assert the transitioned state (then). Application code may start from mere mocks. Replace gradually those mocks with gradually built code and grow your application with higher confidence and quality levels.




回答3:


User story is a feature. Something that can be expressed in format:

  • As role
  • I would like to do something
  • So that goal

E.g.

  • As user
  • I would like to be able to compare products
  • So that I can select a product satisfying my needs in a best way

  • As guest

  • I would like to checkout my shopping cart
  • So that I can complete the purchase

Each feature have to be confirmed by a series of Given-When-Then scenarios of course.




回答4:


You're basically asking what is a feature. Think about it, you have a story, a story describes a feature you (or other people involved) want for your app. Usually it has the form of: As a user I want to view list of products. You may add notes to this story, in order to make it more clear. But then comes the specific behaviour (that eventually you will test against) - there are infinite number of behaviours that conform to this story (think about view of products and the many ways to present them). Your focus, in BDD, is on finding the behaviour that suite your app needs (I use app and not user, because sometimes you should decide for the user) - by talking to as many people as you can, by trying stuff out and iterating it over.

It's like going from top to bottom - always trying to focus on behaviour - being more specific as you go. If you think about it, given a behaviour (meaning a set of tests) there is an infinite number of implementations. That's why the focus of BDD is to truly understand the behaviour by experimenting and talking - there is always a degree of freedom.




回答5:


More important would be to figure out what the user wants to do with the list of products? the feature would be providing something valuable to the user. so in your case it would be

  • Choose a product to view from a list of products
  • Choose x products to compare from a list of products
  • Others



回答6:


I would classify a feature as a minimum useful set of stories that deliver some coherent (business) value.

for BDD framework see http://kernowcode.wordpress.com




回答7:


To determine, if a requirement is an explicit feature / user story, you could use the guidelines of task based design / documentation (e.g. http://www.sprez.com/articles/task-documentation-design.html). Such concepts acknowledge that a user of a system wants to achieve a specific result. Usually, to know something (such as: which products are available) is only a step in the process of purchasing / selling / building / etc. A good starting point in BDD is to write the topics you would use as chapters in your user manual. These topics are usually the features you are going to provide in your software solution. A nice framework that supports such an approach of specification-by-example is Concordion (http://concordion.org). Please have a look at the description of “acceptance tests in plain English” (http://gojko.net/2009/09/01/acceptance-testing-in-plain-english-with-concordion-net/).



来源:https://stackoverflow.com/questions/3234789/bdd-whats-a-feature

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