单元测试的价值 [英] The Value of Unit Testing

查看:360
本文介绍了单元测试的价值的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

下面是一些典型的回答(在corniness的升序排列)由经理/老板我得到每当我提起有单元测试和code覆盖作为开发周期的一个组成部分。

Here are some typical answers(ranked in ascending order of corniness) I get from managers/bosses whenever I bring up the importance of having unit tests and code coverage as an integral part of the development cycle

  1. 在这是QA的工作,只注重功能和发展
  2. 在应用程序是不是关键任务,如果有一些错误,这不是世界的尽头
  3. 在我们不能把时间花在单元测试
  4. 在尽量不要太花哨

虽然有做得不好,在一天结束的最好的意图时,时机成熟的怪游戏,负担最终落在了开发商。

In spite of having the best intentions of doing a good job, at the end of the day when time comes for the blame game, the burden finally falls on the developer.

这是我见过的东西打破生产,其中一些可能已经避免通过运行单元测试,静态地捕获这些错误太频繁。

It's all too often that I've seen that things break in production, some of which which could have been avoided by catching these bugs statically by running unit tests.

我只是想获得一个谈话继续下去,看看人民的经历是,什么是最好的方式来解决这个问题。

I just wanted to get a conversation going to see what peoples experiences have been and what is the best way to tackle this.

更新:谢谢大家了很多有见地的意见。有迹象表明,我希望我能选择的正确答案几个答案。

UPDATE: Thanks everyone for a lot of insightful advice. There are several answers that I wish I could select as the right answer.

推荐答案

引入的单元测试纳入发展过程就像投资:你必须把一些钱锋线后获得的利润。如果你犯的是IT管理应该更加关注这样的比喻:描述一下投资是必需的,然后放下计划,利润

Introducing unit tests into development process is like investment: you have to put some money up front to get profit later. Management should be more attentive to this analogy if you follow through with it: describe what investments are required and then lay down plan for profits.

例如: 投资:

  • 的时间花在执行测试 基础设施(不严重的产品 单元测试是可能的,而不 测试特定的基础设施code 它简化产品的具体 测试模式,测试数据 创建/移除等);
  • 在编写实际的测试时间花费;
  • 在审查的时间花在和 配套试验;
  • time spend to implement test infrastructure (no serious product unit tests can be possible without test-specific infrastructure code that streamlines product specific test patterns, test data creation/removal, etc.);
  • time spend on writing actual tests;
  • time spend on reviewing and supporting tests;
  • etc.

利润:

  • 在没有错误不断重新出现无征兆;
  • 在没有大的功能释放,没有单元测试通过;
  • 循环发展-QA-修复的bug被切成两半的大多数错误:发展单元测试修复的bug;

这篇关于单元测试的价值的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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