Having written a small article on BDD, I got questions from people asking whether there are any cases of large-scale use of BDD (and specifically NBehave).
在写了一篇关于BDD的小文章之后,有人问我是否存在大规模使用BDD(特别是NBehave)的情况。
So my question goes to the community: do you have a project that used BDD successfully? If so, what benefits did you get, and what could have been better? Would you do BDD again? Would you recommend it to other people?
我的问题是关于社区的:你有一个项目成功地使用了BDD吗?如果是这样,你得到了什么好处?你会再做一次BDD吗?你能把它推荐给其他人吗?
4 个解决方案
#1
4
We've used somewhat of BDD at the code level in different scenarios (open source and ND projects).
在不同的场景(开源和ND项目)中,我们在代码级别使用了一些BDD。
-
Telling the view in MVC scenario, what kind of input to accept from user (DDD and Rule driven UI Validation in .NET)
告诉MVC场景中的视图,从用户接收哪种输入(.NET中的DDD和规则驱动的UI验证)
result = view.GetData( CustomerIs.Valid, CustomerIs.From(AddressIs.Valid, AddressIs.In(Country.Russia)));
-
Telling the service layer, about the exception handling behavior (ActionPolicy is injected into the decorators):
告诉服务层,关于异常处理行为(ActionPolicy被注入到decorator中):
var policy = ActionPolicy .Handle<WebException>() .Retry(3);
Using these approaches has immensely reduced code duplication, made the codebase more stable and flexible. Additionally, it made everything more simple, due to the logical encapsulation of complex details.
使用这些方法极大地减少了代码重复,使代码库更加稳定和灵活。此外,由于复杂细节的逻辑封装,它使一切变得更加简单。
#2
2
I was on a small team that used BDD on a website.
我在一个小团队,在一个网站上使用BDD。
The way we used it was essentially TDD, but the tests are simply written as behaviors using a DSL. We did not get into large upfront design of behaviors, but we did create a large number of them, and used them exactly as you would tests.
我们使用它的方式本质上是TDD,但是测试仅仅是用DSL作为行为编写的。我们没有对行为进行大量的预先设计,但是我们确实创建了大量的行为,并且使用它们就像您测试的那样。
As you might expect, it worked much as TDD, generally good. Phrasing the tests as behaviors was nice when interacting with the customers and made for a pretty decent document, but I kind of wish the behaviors were written in English and the tests programmed instead of trying to come up with some difficult intermediate language that doesn't fit either purpose perfectly.
正如您所期望的,它和TDD一样工作得很好。措辞测试行为与客户交互时很好,非常不错的文档,但是我希望的行为是用英语写的测试程序,而不是试图想出一些困难的中间语言的目的完全不适合。
It would still be BDD, just without this cute trick of trying to twist the language into a language delineated by a random_looking.set of_Punctuation rather_than simple.spaces, but that was only my grumpy-old-programmer attitude, everyone else was 100% happy with it.
它仍然是BDD,只是没有这个可爱的技巧,试图将语言转换成一种由随机查找所描述的语言。设置of_Punctuation rather_than简单。空间,但那只是我的老脾气,程序员的态度,每个人都100%满意。
The site is available and fully operational, so I'd call it a success: Have a look
该网站是可用的和完全运作的,所以我认为它是一个成功:看看
#3
1
I recently used the BDD style of GWT in a high-level requirements document. I didn't get any feedback about the GWT from the customer buy my boss said he liked it as it was very clear and easy to understand. Note he has no knowledge of BDD that I know of. I didn't put in user stories as this would probably have been a bit too airy fairy for people with a traditional waterfall background. Maybe I'll try putting in user stories next time.
我最近在一个高级需求文档中使用了BDD风格的GWT。我的老板说他喜欢GWT,因为它非常清晰易懂。注意,他对BDD没有我所知道的知识。我没有输入用户故事,因为对于有传统瀑布背景的人来说,这可能有点过于天马行空。也许下次我会尝试加入用户故事。
By the way this was not a eye ball UI project. It was an integration project syncing data from a web service into a database. So it shows that GWT works even for non-"eye ball" UIs.
顺便说一下,这不是一个眼珠UI项目。它是一个将来自web服务的数据同步到数据库的集成项目。由此可见,GWT即使对于非“eye ball”ui也是有效的。
#4
0
I've been using Context-Specification style on several projects (using MSpec) with great success. I am still trying to understand the real benefits of the Scenario style. The more I use the context-specification style, the more I like it, and the tighter my applications feel.
我已经在几个项目(使用MSpec)上使用了上下文规范风格,并取得了很大的成功。我仍在试图理解场景样式的真正好处。我越使用上下文规范样式,我就越喜欢它,我的应用程序也就越紧凑。
#1
4
We've used somewhat of BDD at the code level in different scenarios (open source and ND projects).
在不同的场景(开源和ND项目)中,我们在代码级别使用了一些BDD。
-
Telling the view in MVC scenario, what kind of input to accept from user (DDD and Rule driven UI Validation in .NET)
告诉MVC场景中的视图,从用户接收哪种输入(.NET中的DDD和规则驱动的UI验证)
result = view.GetData( CustomerIs.Valid, CustomerIs.From(AddressIs.Valid, AddressIs.In(Country.Russia)));
-
Telling the service layer, about the exception handling behavior (ActionPolicy is injected into the decorators):
告诉服务层,关于异常处理行为(ActionPolicy被注入到decorator中):
var policy = ActionPolicy .Handle<WebException>() .Retry(3);
Using these approaches has immensely reduced code duplication, made the codebase more stable and flexible. Additionally, it made everything more simple, due to the logical encapsulation of complex details.
使用这些方法极大地减少了代码重复,使代码库更加稳定和灵活。此外,由于复杂细节的逻辑封装,它使一切变得更加简单。
#2
2
I was on a small team that used BDD on a website.
我在一个小团队,在一个网站上使用BDD。
The way we used it was essentially TDD, but the tests are simply written as behaviors using a DSL. We did not get into large upfront design of behaviors, but we did create a large number of them, and used them exactly as you would tests.
我们使用它的方式本质上是TDD,但是测试仅仅是用DSL作为行为编写的。我们没有对行为进行大量的预先设计,但是我们确实创建了大量的行为,并且使用它们就像您测试的那样。
As you might expect, it worked much as TDD, generally good. Phrasing the tests as behaviors was nice when interacting with the customers and made for a pretty decent document, but I kind of wish the behaviors were written in English and the tests programmed instead of trying to come up with some difficult intermediate language that doesn't fit either purpose perfectly.
正如您所期望的,它和TDD一样工作得很好。措辞测试行为与客户交互时很好,非常不错的文档,但是我希望的行为是用英语写的测试程序,而不是试图想出一些困难的中间语言的目的完全不适合。
It would still be BDD, just without this cute trick of trying to twist the language into a language delineated by a random_looking.set of_Punctuation rather_than simple.spaces, but that was only my grumpy-old-programmer attitude, everyone else was 100% happy with it.
它仍然是BDD,只是没有这个可爱的技巧,试图将语言转换成一种由随机查找所描述的语言。设置of_Punctuation rather_than简单。空间,但那只是我的老脾气,程序员的态度,每个人都100%满意。
The site is available and fully operational, so I'd call it a success: Have a look
该网站是可用的和完全运作的,所以我认为它是一个成功:看看
#3
1
I recently used the BDD style of GWT in a high-level requirements document. I didn't get any feedback about the GWT from the customer buy my boss said he liked it as it was very clear and easy to understand. Note he has no knowledge of BDD that I know of. I didn't put in user stories as this would probably have been a bit too airy fairy for people with a traditional waterfall background. Maybe I'll try putting in user stories next time.
我最近在一个高级需求文档中使用了BDD风格的GWT。我的老板说他喜欢GWT,因为它非常清晰易懂。注意,他对BDD没有我所知道的知识。我没有输入用户故事,因为对于有传统瀑布背景的人来说,这可能有点过于天马行空。也许下次我会尝试加入用户故事。
By the way this was not a eye ball UI project. It was an integration project syncing data from a web service into a database. So it shows that GWT works even for non-"eye ball" UIs.
顺便说一下,这不是一个眼珠UI项目。它是一个将来自web服务的数据同步到数据库的集成项目。由此可见,GWT即使对于非“eye ball”ui也是有效的。
#4
0
I've been using Context-Specification style on several projects (using MSpec) with great success. I am still trying to understand the real benefits of the Scenario style. The more I use the context-specification style, the more I like it, and the tighter my applications feel.
我已经在几个项目(使用MSpec)上使用了上下文规范风格,并取得了很大的成功。我仍在试图理解场景样式的真正好处。我越使用上下文规范样式,我就越喜欢它,我的应用程序也就越紧凑。