`
javasee
  • 浏览: 960500 次
  • 性别: 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>
分享到:
评论

相关推荐

    软件测试驱动开发从这里开始

    通过学习这份资料,你可以进一步了解TDD如何提高软件开发的效率和质量,以及如何将TDD的理念融入到你的开发流程中。 总之,测试驱动开发是一种强大的工具,它可以帮助我们构建更可靠、更易于维护的软件。通过遵循...

    软件项目测试PPT

    黑盒测试则是一种与程序内部实现无关的测试方法,也称为功能测试。测试者仅关注软件的输入、输出以及系统行为,而不关心代码的内部结构。黑盒测试主要验证软件的功能是否符合用户需求和规格说明书,适用于系统测试和...

    步进电机驱动器测试例程.zip

    总的来说,这个压缩包提供了一套完整的解决方案,包括硬件连接指南、软件开发环境和实际的控制代码,帮助工程师快速上手并测试42、57和82步进电机在STM32平台上的驱动控制。通过学习和实践这些例程,用户可以深入...

    基于模型驱动的软件开发方法.ppt

    模型驱动的软件开发方法是一种先进的软件工程方法论,它强调以模型为中心,通过构建一系列抽象模型来描述软件系统的各个层面,从而实现从概念到代码的转换。这种方法论源于软件开发技术的发展历程,从早期的面向功能...

    测试系统中的软件平台

    例如,VISA(虚拟仪器软件体系)为各种仪器提供了统一的软件接口,使得开发跨平台的测试应用变得更加便捷。测试软件的标准化和驱动器技术的进步,为测试工程师提供了强大的工具,以应对日益复杂的测试需求和挑战。 ...

    软件开发最前沿技术介绍

    MDA是一种以模型为中心的软件开发方法,它将业务逻辑转换为平台无关模型(PIM),然后通过转换生成平台相关的模型(PSM),最终生成代码。这种方法旨在提高开发效率,减少错误,并简化系统迁移。 5. **面向Agent的...

    Windows驱动开发系列之一:小白入门经典.pdf

    - **定义**: 驱动程序是一种特殊的软件,用于让操作系统能够识别和控制硬件设备或实现特定功能。 - **作用**: - 控制硬件设备 - 实现应用程序难以实现的功能 - 创建虚拟设备 - **特点**: - 要加载到内核中运行 ...

    领域驱动设计和开发实战.pdf

    - **测试驱动开发**:采用TDD(Test-Driven Development)方法提高代码质量和可测试性。 - **重构实践**:持续改进代码结构,提升软件质量。 #### 四、团队能力与协作 - **领域专家参与**:业务领域的主题专家应该...

    如何使用IBMRationalSoftwareArchitect实现模型驱动的软件开发借鉴.pdf

    RSA通过集成的开发环境和模型转换工具,使得MDA成为现实,促进了软件开发的标准化和平台无关性,有助于软件系统的可维护性和可扩展性。随着MDA理念和技术的不断发展,RSA等工具将更加完善,为未来的软件工程带来更大...

    软件测试资料(QC、QTP、TD).rar

    6. "软件测试开发.pdf":这可能深入讨论测试在软件开发生命周期中的角色,包括测试策略、测试自动化、持续集成等。 7. "测试驱动的设计和开发.pdf":与前面的"测试驱动开发.pdf"类似,可能更专注于TDD如何影响软件...

    软件开发统一过程(RUP)培训资料

    《软件开发统一过程(RUP)培训资料》 ...总之,RUP通过其迭代开发、风险驱动、用例驱动和架构基础,提供了软件开发的全面指导。结合UML的建模能力,能够有效地管理和控制复杂软件项目,确保软件质量和满足客户需求。

    嵌入式软件自动化测试及管理系统研究.pdf

    实践证明,使用自动化测试及管理系统开展嵌入式软件测试,可以有效提高测试效率和质量,这对于现代软件开发流程是一个重大的进步。在实际的测试项目中,这样的系统能够减少手动操作错误,增加测试的可重复性,同时也...

    Windows驱动开发技术详解

    1. 设备驱动接口(DDI):这是Windows提供的一套编程接口,允许驱动开发者编写与特定硬件无关的代码。例如,通用的IoControl函数用于处理设备I/O控制请求,DeviceIoControl是与硬件设备交互的重要手段。 2. 驱动...

    基于VxWorks的双串口芯片的驱动开发.pdf

    总的来说,本文提供了一个在VxWorks环境下双串口芯片驱动开发的详尽实例,它不仅提供了开发流程和数据结构的设计,还包括了初始化过程、程序加载与卸载的细节,以及必要的测试验证环节。对于希望深入理解嵌入式系统...

    国产自主可控软件测试ETest.docx

    此外,它的底层技术无关性意味着系统能够屏蔽操作系统、硬件驱动和接口编程等复杂细节,降低了使用门槛。 在物理参数上,该测试仪采用加固平板设计,尺寸约为337mm(W) * 218mm(D) * 62mm(H),重量约为4公斤,适合...

    软件测试常用术语表很有用的哦

    24. **黑盒测试 (Black Box Testing)**:也称为功能测试或数据驱动测试,测试者只关注输入和输出,而不关心内部实现细节。 25. **自底向上测试 (Bottom-Up Testing)**:一种集成测试策略,先从最底层的模块开始测试...

    精通Linux设备驱动程序开发(样章)

    ### 精通Linux设备驱动程序开发:输入设备驱动 #### 概述 在Linux操作系统中,设备驱动程序是连接硬件设备与操作系统的关键组件。针对输入设备,如键盘、鼠标等,开发相应的驱动程序尤为重要。本文将根据提供的...

Global site tag (gtag.js) - Google Analytics