是单元测试测试/原型开发过程中一个坏主意? [英] Is unit testing a bad idea during beta/prototyping?

查看:129
本文介绍了是单元测试测试/原型开发过程中一个坏主意?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我们开始推出了很多我们不那么熟悉的新技术,新项目,一个架构,我们没有大量的实践中,换句话说,接口和服务类等之间的相互作用我们正在构建相当动荡,更是这样,由于内部和客户的反馈。虽然我一直在不断移动的规范沮丧,我认为这在一定程度上建立的东西,我们以前从来没有建造的必要组成部分 - 如果我们只是坚持原来的设计和范围,最终产品可能会是一大堆缺乏创新,比它很有用的得体。

A new project we began introduced a lot of new technologies we weren't so familiar with, and an architecture that we don't have a lot of practice in. In other words, the interfaces and interactions between service classes etc of what we're building are fairly volatile, even more so due to internal and customer feedback. Though I've always been frustrated by the ever-moving specification, I see this to some degree a necessary part of building something we've never built before - if we just stuck to the original design and scope, the end product would probably be a whole lot less innovative and useful than it's becoming.

我还介绍了测试驱动开发(TDD),因为好处是证据充分的概念和我爱的想法。两个新的东西要学 - NUnit的和嘲弄 - 但看到那些绿色的圆圈使这一切值得

I also introduced test-driven development (TDD), as the benefits are well-documented and conceptually I loved the idea. Two more new things to learn - NUnit and mocking - but seeing all those green circles made it all worthwhile.

随着时间的推移,然而,在这些设计不断变化似乎意味着,我几乎花光了一大堆更多的时间改变我的测试中,比我是在写code本身。仅仅出于这个原因,我已经回测试的老路子 - 即没有自动

Over time, however, those constant changes in design seemed to mean I was spending a whole lot more time changing my tests than I was on writing the code itself. For this reason alone, I've gone back to the old ways of testing - that is, not automated.

虽然我毫不怀疑,该应用程序将远远数百个优秀的单元测试更健壮,我发现时间的权衡推出的产品是大多不能接受的。我的问题是,那么 - 有什么,你也发现,TDD可以是一个麻烦,如果你的东西原型/建设一个测试版?难道TDD去更自然手牵手与一些地方的规格较为固定,或在开发人员的语言和技术,更多的经验?还是我做了一些根本性的错误?

While I have no doubt that the application would be far more robust with hundreds of excellent unit tests, I've found the trade-off of time to launch the product to be mostly unacceptable. My question is, then - have any of you also found that TDD can be a hassle if you're prototyping something / building a beta version? Does TDD go much more naturally hand-in-hand with something where the specifications are more fixed, or where the developers have more experience in the language and technologies? Or have I done something fundamentally wrong?

请注意,我不是想在这里批评TDD - 只是我不知道它总是在各种情况下最适合

Note that I'm not trying to criticise TDD here - just I'm not sure it's always the best fit for all situations.

推荐答案

简短的回答是,TDD是测试版的非常有价值的,但的可能的少所以对于原型设计。

The short answer is that TDD is very valuable for beta versions, but may be less so for prototyping.

我想测试版和原型区别开来是非常重要的。

I think it is very important to distinguish between beta versions and prototyping.

A 测试版版本本质上是一个生产版本,只是仍处于开发阶段,所以你一定要在场景中使用TDD。

A beta version is essentially a production version that is just still in development, so you should definitely use TDD in that scenario.

A 原型 /概念证明是值得你用把它扔了,一旦你已经得到答案了吧,你想的前preSS意图。

A prototype/proof of concept is something you build with the express intent of throwing it away once you've gotten the answers out of it that you wanted.

这是真的,项目经理往往会推动原型用作生产code的基础,但它抵抗是非常重要的。如果你知道这是不可能的,对待原型code,你会生产code,因为你知道它的的将成为您在未来的生产code - 和这意味着你应该使用TDD与它。

It's true that project managers will tend to push for the prototype to be used as a basis for production code, but it is very important to resist that. If you know that's not possible, treat the prototype code as you would your production code, because you know it is going to become your production code in the future - and that means you should use TDD with it as well.

当你正在学习一种新的技术,最code样品等等都没有考虑单元测试写成的,所以可能很难将新技术转化为单元测试的心态。它最肯定感觉就像很多开销。

When you are learning a new technology, most code samples etc. are not written with unit tests in mind, so it can be difficult to translate the new technology to the unit testing mindset. It most definitely feels like a lot of overhead.

在我的经验,但是,单元测试往往真的强迫你推你正在学习新技术的界限。很多时候,你需要研究和学习各种不同的挂钩新技术提供的,因为你需要能够通过DI或类似的隔离技术。

In my experience, however, unit testing often really forces you to push the boundaries of the new technology that you are learning. Very often, you need to research and learn all the different hooks the new technology provides, because you need to be able to isolate the technology via DI or the like.

而不仅仅是跟随老路,单元测试经常迫使你学习技术,更深入,因此可能会觉得是什么样的开销实际上只是一个更深入的原型 - 一个往往更有价值,因为它占地地上。

Instead of only following the beaten path, unit testing frequently forces you to learn the technology in much more depth, so what may feel like overhead is actually just a more in-depth prototype - one that is often more valuable, because it covers more ground.

我个人认为,单元测试一项新技术是一个很好的学习工具。

Personally, I think unit testing a new technology is a great learning tool.

您似乎对测试可维护性遇到的症状有点正交的,我想。你的测试可能的 Overspecified 的,这是一件好事已知技术时(但我认为这可能是可以发生一样好的更容易的掉入这个陷阱,当你也是学习的同时新的技术)。

The symptoms you seem to experience regarding test maintainability is a bit orthogonal, I think. Your tests may be Overspecified, which is something that can happen just as well when working with known technologies (but I think it is probably easier to fall into this trap when you are also learning a new technology at the same time).

这本书的xUnit测试模式介绍Overspecified测试反模式,并提供了大量的指导和模式,可以帮助你编写更易于维护的测试。

The book xUnit Test Patterns describes the Overspecified Test antipattern and provides a lot of guidance and patterns that can help you write more maintainable tests.

这篇关于是单元测试测试/原型开发过程中一个坏主意?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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