在最近的工作中接触到了TDD,其实严格的说也不能算纯粹的TDD,不过test已经覆盖了大部分的代码功能点,持续集成方面采用的软件是anthill,当然还有CruiseControl可以选择。
有关TDD和持续集成都足够独立成文,也有很多相关的介绍文章,这里只是简单描述下我们的做法:
1。保证大部分功能点都有相关的test(因为某些原因,我们没有做到TDD要求的测试先行,有待以后改进)
2。在ant脚本中加入JUnit test部分,目的是达到自动执行批量test并且能够test fail->build fail。
3。在版本控制器(svn)上加上anthill的支持
这样协作开发的步骤就是:从svn update 代码->首先进行cleanbuild确保修改前的代码是无错的->进行代码及相应test的修改(按照TDD这里的顺序应该是反过来)- >再次cleanbuild确保修改后的代码是无错的->svn commit->通过anthill web界面进行build查看结果
全部正确就算完成了一次修改,可以看出test和持续集成的作用,既保证了代码实时的正确性,又保证了trouble shooting的准确快速。
无怪spring和pico的作者都提到TDD从某种程度上讲是致瘾的,习惯了它的开发者很难再回到原来的开发模式。想来一定是会感到缺乏安全感吧:)回想以前总是担忧自己项目中bug横行却无计可施的日子,恐怕真的离不开test了。
必要的软件:
Eclipse-最重要的了,提供了对Junit和Refactoring的良好支持
JUnit-使test细致到function一级,以清晰的红绿灯显示测试的结果
Ant-支持自动化的test过程
EasyMock-如果你使用MockObject协助test
anthill(CruiseControl)-持续集成软件
推荐的参考读物:
http://news.csdn.net/news/newstopic/21/21164.shtml Martin Fowler:持续集成
Test-Driven Development A Practical Guide 测试驱动开发实用指南(中国电力出版社)jolt大奖得主哦
分享到:
相关推荐
By taking you through the development of a real web application from beginning to end, the second edition of this hands-on guide demonstrates the practical advantages of test-driven development (TDD) ...
Test-driven development (TDD) is a proven way to find software bugs early. Writing tests before your code improves the structure and maintainability of your app. Test-driven iOS Development with ...
Chapter 1, Why Should I Care for Test-Driven Development?, spells out our goal of becoming a Java developer with a TDD black belt. In order to know where we're going, we'll have to discuss and find ...
C# and .NET Core Test Driven Development: Dive into TDD to create flexible, maintainable, and production-ready .NET Core applications Learn how to apply a test-driven development process by building ...
Title: Test-Driven Development with Python, 2nd Edition Length: 592 pages Edition: 2 Language: English Publication Date: 2017-08-10 ISBN-10: 1491958707 ISBN-13: 9781491958704 Table of Contents Part I...
By taking you through the development of a real web application from beginning to end, the second edition of this hands-on guide demonstrates the practical advantages of test-driven development (TDD) ...
• Use agile techniques such as test-driven development, behavior-driven development, and continuous integration • Improve the speed and overall performance of your app • Organize an Android app ...
His big passions are DevOps, Containers, Kubernetes, Microservices, Continuous Integration, Delivery and Deployment (CI/CD) and Test-Driven Development (TDD). He often speaks at community gatherings ...
Test-Driven-Development(TDD) — designed to streamline the TDD workflow Continuous Integration(CI) — designed to work well with popular CI servers like Jenkins or Teamcity 跨平台: OS X ...
As such, we will enforce a Test-Driven Development (TDD) process using Selenium, Cucumber, Mocha, Sinon, and Istanbul. As we progress through the book, the focus will shift towards automation and ...
Write flexible, maintainable, and verifiable code for .NET Core Write testable code using SOLID principles and dependency injections ...Set up an end-to-end continuous integration process
This book also looks at how to write your Swift apps using test driven development (TDD). Agile practices have made major inroads in iOS development, however it’s very unusual to see something as ...
Test-driven development (TDD) is the practice of writing tests before writing the code they test. Imposters (a.k.a. mock objects) provide a powerful unit-testing technique to isolate units of code. I ...
'Infrastructure as Code' has emerged alongside the DevOps movement as a label for approaches that merge concepts like source control systems, Test Driven Development (TDD) and Continuous Integration ...
Node.js中的单元测试介绍这是一个快速的示例项目,展示了如何在Node.js中设置测试环境它包括以下内容-测试框架-断言库-覆盖率测试数据的存根和接头以下在线工具用于监视结果持续集成依赖性管理-自动化代码质量评论...
"Infrastructure as Code" has emerged alongside the DevOps movement as a label for approaches that merge concepts like source control systems, Test Driven Development (TDD) and Continuous Integration ...
"Infrastructure as Code" has emerged alongside the DevOps movement as a label for approaches that merge concepts like source control systems, Test Driven Development (TDD) and Continuous Integration ...