使用 Specflow 驱动基于 .NET MVC 3 的项目的外部开发
我想使用 TDD 和 DDD 进行 ATDD,并且我想首先发现域模型(在我的示例中是电子商务)的行为(使用模拟)。 您可以想象,在 DDD 分层中,我们可以让应用程序服务调用域服务和存储库或其他服务和非业务逻辑代码,仅与应用程序相关的任务) 请使用下面我试图理解的文本:
如何使用模拟来发现我的电子商务域的行为,然后进行更细粒度的 TDD 开发来实现所需的行为。
这是另一个问题的摘录(作为答案)。
“选择您需要实现的任何任务,打开一个空白文本文件并尝试使用简单的句子来解释行为。每个句子应该以三个关键字之一开头:given、when 和 then。使用您最喜欢的 BDD 框架编写将解析这些句子并刺激应用程序进入启动状态的代码。 (给定),执行一些命令(当)和断言转换状态(然后)应用程序代码可以从纯粹的模拟开始,用逐步构建的代码逐渐替换这些模拟,并以更高的信心和质量水平发展您的应用程序。”
有人可以提供一些使用两种方法从模拟(RhinoMock、Moq)开始的具体示例:
1.通过控制器的操作驱动 ATDD 和
2.使用 Watin 驱动程序(页面对象、WatiN MVCContrib 扩展)或 Selenium。
如果我用的是no. 2.当我自己访问某些页面并执行某些操作(“当”我执行某些操作时:导航、发布数据)时,我是否能够看到一些示例数据并验证这些操作的结果。
要完全理解我的问题的性质,请阅读以下内容: http://jockeholm.wordpress.com/2010/02 /14/组合-tddbdd-与-ddd/ 特别是步骤 3 和 4。
我将提供步骤 3 的文本:
3.[BDD/ATDD] 对于每个测试场景,实现一个失败的可执行示例,因为系统不支持该行为。然后,使用由外向内的开发,并广泛使用模拟对象,以充实可执行示例中指定的行为。
谢谢, 拉德
I want to do ATDD with TDD and DDD and I want to first discover behaviors (using mocks) of a domain model (ecommerce in my example).
You can imagine that in DDD layering we can have application services calling domain services and repositories or other services and non business logic code, only tasks related to the application)
Please use the text below that I am trying to understand:
HOW TO USE MOCKS TO DISCOVER BEHAVIOUR OF MY ECOMMERCE DOMAIN AND THEN ENTER MORE GRANULAR TDD DEVELOPMENT TO IMPLEMENT DESIRED BEHAVIOUR.
This is an excerpt from another question (as an answer).
"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."
Can someone provide some concrete examples of starting with mocks (RhinoMock, Moq) using two approaches:
1.Driving ATDD via Controller's actions and
2.Using Watin Driver (Page Objects, WatiN MVCContrib extensions) or Selenium.
If I am using no. 2. will I be able to see some example data when I visit some pages myself and do some actions ("When" I do something: navigate, post data) and validate results of these actions.
To fully understand the nature of my question please read this:
http://jockeholm.wordpress.com/2010/02/14/combining-tddbdd-with-ddd/
Especially Steps 3. and 4.
I will privide the text for step 3:
3.[BDD/ATDD] For each test scenario, implement an executable example that fails, since that behaviour is not supported by the system. Then, use outside-in development, with an extensive use of mock objects, to flesh out the behavior specified in the executable example.
Thanks,
Rad
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
这可能会有所帮助:
http://msdn.microsoft.com/en-us/magazine /dd882516.aspx
This may help:
http://msdn.microsoft.com/en-us/magazine/dd882516.aspx