`
javasee
  • 浏览: 923995 次
  • 性别: Icon_minigender_1
  • 来自: 北京
文章分类
社区版块
存档分类
最新评论

“测试驱动的软件开发”,与测试无关

阅读更多

Test-Driven Development Is Not About Testing

Summary
I am always on the look out for good questions to ask candidates in an interview. Not the "How many oranges can I fit in this room?" kind of nonsense (the stock response to which is apparently "with or without us standing in it?").
By Dan North
Page 1 of 1

<advert mode="instory"><p>I am always on the look out for good questions to ask candidates in an interview. Not the "How many oranges can I fit in this room?" kind of nonsense (the stock response to which is apparently "with or without us standing in it?"). Nor the picky, encyclopedic type such as "In the javax.obscure.DustyCorner class, which method throws a FullyDocumentedException?" (If you do not respond with "I would check the Javadocs" on the grounds that you actually know, you really ought to get out more.) </p> <p>Instead, I like the sort of technical question that allows candidates to demonstrate real insight; where they can show not only technical depth and breadth, but also a mature understanding of the software development process. So I was delighted when a colleague offered me a perfect interview question, namely: "What is the point of test-driven development?" </p> <p>Test-driven development (TDD) has grown out of the Agile software movement (<a href="http://www.agilealliance.org/" target="new">www.agilealliance.org</a>) and Extreme Programming (XP) in particular. Extreme Programming stipulates a set of best practices that collectively encourage core values such as feedback and simplicity. The feedback occurs in the form of tests, by delivering in short iterations, and by the simple expedient of talking to one another. The simplicity comes from the process of refactoring - ruthlessly - and from only delivering exactly what the software has to do right now. </p> <p>Kent Beck, the original champion of XP, has extracted the essence of its development practices and named it test-driven development. And so to the model interview answer. The point of TDD is to drive out the functionality the software actually needs, rather than what the programmer thinks it probably ought to have. The way it does this seems at first counterintuitive, if not downright silly, but it not only makes sense, it also quickly becomes a natural and elegant way to develop software. </p> <p>We start by writing some client code <em>as though the code we want to develop already existed</em> and had been written purely to make our life as easy as it could possibly be. This is a tremendously liberating thing to do: by writing a model client for our code, in the form of a test, we can define programmatically the most suitable API for our needs. In addition, we assert the behavior we want. </p> <p>Obviously this won't even compile, and this is the counterintuitive part - the code that will sit on the other side of the API doesn't even exist yet! The next stage is to write the minimum amount of code to get the test <em>compiling</em>. That's all, just a clean compile, so you can run the test (which at this stage will fail). IDEs such as IntelliJ IDEA or the open source Eclipse will generate missing classes and implement missing methods for you. Now, and only now, you write the application code to satisfy the test. The final piece of the puzzle is to refactor the code so it's as simple as it can be. This then becomes your development rhythm: write a test, write some code, refactor. </p> <p>Writing the test before you write the code focuses the mind - and the development process - on delivering only what is absolutely necessary. In the large, this means that the system you develop does exactly what it needs to do and no more. This in turn means that it is easy to modify to make it do more things in the future as they are driven out by more tests. </p> <p>We keep the tests we wrote and run all of them, often, to make sure the system does everything it is supposed to do (and to alert ourselves immediately if we break any existing functionality). However, the extremely useful test suite we've created is very much a secondary benefit of the TDD process. </p> <p>So when you're sitting in an interview and someone asks you about testdriven development, remember that it's not about the tests; it's about seeing how little you actually need to do and how cleanly you can do it! If someone asks you to fill a room with oranges? Well, I'll leave that to you. </p> <p><em>What do you think? Join the <a href="http://www.sys-con.com/story/37795_f.htm">Feedback</a> to this item.</em> </p></advert>
分享到:
评论

相关推荐

    软件测试经典面试题 (超实用)

    (可以包括软件测试、过程改进、软件开发或者与此无关的其他方面) 35 11、为什么选择测试这行? 35 12、你的工作通常能在时限内完成吗.(我想问一下就是她问这个问题的动机是什么) 35 13、通常你对于别人批评你会...

    软件测试作业及习题评讲

    8 软件测试在软件开发过程中是可选的,在项目时间比较紧时,可以省略测试的过程× 软件测试的误区 误区一:如果发布出去的软件有质量问题,都是软件测试人员的错 误区二:软件测试技术要求不高,至少比编程容易多了...

    Ruby_Framework:使用ruby的自动化框架

    Ruby自动化测试回购包含用于测试UI / API的ruby自动化框架。 使用Cucumber,SitePrism,水豚CucumberCucumber是... 它与运行测试程序的驱动程序无关,并且内置了Rack :: Test和Selenium支持。WebKit通过外部gem支持。

    百度地图开发java源码-BizMDA:BizMDA-模型驱动的商业应用构建平台

    BizMDA是一个基于模型驱动架构的商业应用开发平台,支持多种技术开发框架,通过数据建模、视图建模、服务建模、菜单建模等针对商业应用的建模,来快速支持WEB应用、APP应用和小程序的开发,并且让商业应用建模模型与...

    altera原厂多层开发板 allegro 原理图+pcb

    与平台无关 通过JTAG与PC连接 嵌入式Blaster 用户可控 VOD和预加重设置 均衡器设置 测试码型 状态指示器 误码数量 BER 锁定信号 EyeQ在器件接收器重建眼图,监视均衡后的信号完整性(高达6 Gbps)

    altera原厂多层开发板 原理图+PCB allegro 格式.rar

    与平台无关 通过JTAG与PC连接 嵌入式Blaster 用户可控 VOD和预加重设置 均衡器设置 测试码型 状态指示器 误码数量 BER 锁定信号 EyeQ在器件接收器重建眼图,监视均衡后的信号完整性(高达6 Gbps) allegro , pcb ...

    新版Android开发教程.rar

    ANDROID 的推出后可能影响的产业包括移动电信业,软件开发业,手机制造业,在以消费者为核心的状 态 。 对消费者的影响 � 高档手机选择面增加。 � A ndroid 在设计初期就考虑了与现其有业务的融合,改变以往从...

    java开源包10

    JOpt Simple 是一个简单的、测试驱动的命令行解析器,支持 POSIX getopt() 和 GNU getopt_long() Java的HTTP代理服务器 Smart Cache Smart Cache 是一个采用 Java 开发的 HTTP/1.1代理服务器,也可以用来作为Web的...

    OrderBot:餐馆与美食博物馆

    通过提供测试工具,开箱即用的Web驱动程序实施以及其他工具(例如具有驱动程序安装,类生成和配置支持的增强的CLI),可以显着加快开发速度。文献资料您可以在找到BotMan和BotMan Studio文档。支持发展你喜欢这个...

    SkyEye教程

    对于那些想进行嵌入式系统软件开发和学习,或者想研究嵌入式Linux等操作系统和一些底层系统软件(如TCP/IP等)的研究和开发人员来说,可能存在如下几方面的问题:(1)经常苦于经费不足,缺少足够的硬件开发板和完善...

    MaxDOS_71PXE_G115.rar

    9.安装MaxDOS时请在解压RAR压缩包后安装,并关闭其它无关程序,避免引起未知的错误. 10.当安装时将启动等待时间设为:0 时,则启动时不会出现MaxDOS的入口选项,相对的系统启 度也会快些,需要进入MaxDOS,请在启动时狂按...

    Facebook的聊天机器人

    通过提供测试工具,开箱即用的Web驱动程序实现以及其他工具(例如具有驱动程序安装,类生成和配置支持的增强的CLI),可以显着加快开发速度。 文献资料 您可以在找到BotMan和BotMan Studio文档。 支持发展 你喜欢这...

    BotTelegram

    通过提供测试工具,开箱即用的Web驱动程序实施以及其他工具(例如具有驱动程序安装,类生成和配置支持的增强的CLI),可以显着加快开发速度。文献资料您可以在找到BotMan和BotMan Studio文档。支持发展你喜欢这个...

    BotManDemo

    通过提供测试工具,开箱即用的Web驱动程序实施以及其他工具(例如具有驱动程序安装,类生成和配置支持的增强的CLI),可以显着加快开发速度。 文献资料 您可以在找到BotMan和BotMan Studio文档。 支持发展 你喜欢这...

    botman-studio

    通过提供测试工具,开箱即用的Web驱动程序实施以及其他工具(例如具有驱动程序安装,类生成和配置支持的增强的CLI),可以显着加快开发速度。 文献资料 您可以在找到BotMan和BotMan Studio文档。 支持发展 你喜欢这...

    studio:STUdio-故事出纳员释放

    该软件仍处于开发的早期阶段,因此尚未经过全面测试。 特别是,它仅在很少的设备上使用过,可能会使您的设备变砖。 自行承担风险使用。 * Lunii是Lunii SAS的注册商标。 我(与这项工作无关)与Lunii SAS无关。 ...

    Youcef_allalla

    通过提供测试工具,开箱即用的Web驱动程序实现以及其他工具(例如具有驱动程序安装,类生成和配置支持的增强的CLI),可以显着加快开发速度。 文献资料 您可以在找到BotMan和BotMan Studio文档。 支持发展 你喜欢这...

    dev-chatbot-flow

    通过提供测试工具,开箱即用的Web驱动程序实施以及其他工具(例如具有驱动程序安装,类生成和配置支持的增强的CLI),可以显着加快开发速度。 文献资料 您可以在找到BotMan和BotMan Studio文档。 支持发展 你喜欢这...

    JAVA上百实例源码以及开源项目

     Tcp服务端与客户端的JAVA实例源代码,一个简单的Java TCP服务器端程序,别外还有一个客户端的程序,两者互相配合可以开发出超多的网络程序,这是最基础的部分。 递归遍历矩阵 1个目标文件,简单! 多人聊天室 3...

    java开源包1

    JOpt Simple 是一个简单的、测试驱动的命令行解析器,支持 POSIX getopt() 和 GNU getopt_long() Java的HTTP代理服务器 Smart Cache Smart Cache 是一个采用 Java 开发的 HTTP/1.1代理服务器,也可以用来作为Web的...

Global site tag (gtag.js) - Google Analytics