我应该在单元测试级别使用specflow吗? [英] Should I use specflow at unit test level?

查看:99
本文介绍了我应该在单元测试级别使用specflow吗?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

可能重复:
用于单元测试的SpecFlow/BDD吗?

Possible Duplicate:
SpecFlow/BDD for Unit Tests?

在过去的几年中,我一直使用NUnit/Moq在TDD中工作,而在最近的几个月中,我一直在使用mSpec来处理BDD.

Over the last few years I have worked in TDD using NUnit/Moq and over the last few months I have been getting to grips with BDD using mSpec.

到目前为止,还不错,但是我们现在想更多地进入基于验收标准的测试,业务分析师参与其中,并且在开发过程中有所作为.

So far so good but we now want to move more into acceptance criteria based tests where the business analysts are involved and we get an outside in development process.

因此,现在我们有了预定义的Gherkin语法文件,并且有了specflow,它才是正确的工作方式.

So now we have predefined Gherkin syntax files and with specflow it feels the right way to work.

但是,在具有预定义的Gherkin文件的单元测试级别上,将与我对TDD的理解背道而驰.换句话说,您可以随着行为的不断发展而进行设计.

However, at a unit test level having predefined Gherkin files would go against what I understand about TDD. In other words, you design as you go a long evolving your design with behaviour.

当我们在使用外部方法时,现在可以在单元测试级别上使用我们现在可以用来驱动我的单元测试的规范/行为(就像感觉与我的方法相反)在做TDD)?

As we are working using the outside in approach, now at unit test level could it be that we now have the specifications/behaviors that can now be used to drive my unit tests (just feels like it is against the way I have been doing TDD)?

以前这些文件对于验收测试很重要,但是作为开发人员,我将独自工作,因此除非使用SpecFlow,否则它们不是必需的.

Earlier these files were important for acceptance tests but as a developer I will work alone so they are not necessary unless I use SpecFlow.

使用mspec时,在维护GWT文件的单元测试级别上还能获得什么好处?开发人员应该能够跳入代码并阅读测试,或者只是运行测试运行器以查看其作用.

Also what benefit would we have at a unit test level having GWT files maintained when we are using mspec? Developers should be able to just jump into the code and read the tests or just run the test runner to see what it is doing.

TIA 京东

推荐答案

我自发的回答是否"

BDD和诸如specflow和Cucumber之类的工具的主要好处是,与项目的利益相关者进行了交流,并对要构建的内容达成了共识.

Tha main benefit of BDD and tools like specflow and Cucumber is communication with the stakeholders of the project and creating a shared understanding of what is to be built.

TDD的主要好处是通过解决方案实施的一些小步骤,可确保您构建可维护的出色代码.

The main benefit of TDD is to take small steps through a solutions implementation, ensuring that you build maintainable and great code.

或者,如果您愿意的话; BDD的目的是确保我们正在构建正确的事物,TDD的目的是确保我们构建正确的事物.

Or if you want; BDD is about ensuring that we're building the right thing, TDD is about ensuring that we're building it right.

前几天,如果您需要更多详细信息,我已经在我的博客上回答了这样的问题; http://www.marcusoft.net/2011/11/bdd -and-technical-scenarios.html

I answered a question like this the other day on my blog, if you want more details; http://www.marcusoft.net/2011/11/bdd-and-technical-scenarios.html

这篇关于我应该在单元测试级别使用specflow吗?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆