Test Driven Development

《Test-Driven development By Example》阅读(一) SQ3R阅读法:   一、Survey(阅读前的调查)       1、书名:《Test-Driven development By Example》,中文译名《测试驱动开发实例》。     2、作者:Kent Beck(肯特·贝克),美国著名软件工程师与作家,在软件工程方面有很大的贡献。他是Smalltalk软件的开发者,设计模式的先驱,测试驱动开发的支持者,也是极限编程的创始者之一。 阅读详情

 

 Test Driven Development


 

When you code, alternate these activities:

 

This inner loop pumps the outer loops of  ExtremeProgramming -  ContinuousIntegration, DailyDeployment ?,  FrequentReleases, and  SteeringSoftwareProjects. ( Hence the graphic.) Tests help us keep promises regarding the quality, cost, and existence of previously installed features.

 

Using this system, all my code is highly decoupled (meaning easy to re-use) because it all already has two users - its clients, and its test rigs. Classes typically resist the transition from one user to two, then the rest are easy. I make reuse easy as a side-effect of coding very fast.

 

Then, the "remove duplication" phase forces one to examine code for latent abstractions that one could express via virtual methods and other techniques that naturally make code more extendable. This is the "reuse" that the OO hype of the 1980s screamed about.

 


  • Think about what you want to do.
  • Think about how to test it.
  • Write a small test. Think about the desired API.
  • Write just enough code to fail the test.
  • Run and watch the test fail. (The test-runner, if you're using something like JUnit, shows the "Red Bar"). Now you know that your test is going to be executed.
  • Write just enough code to pass the test (and pass all your previous tests).
  • Run and watch all of the tests pass. (The test-runner, if you're using JUnit, etc., shows the "Green Bar"). If it doesn't pass, you did something wrong, fix it now since it's got to be something you just wrote.
  • If you have any duplicate logic, or inexpressive code, refactor to remove duplication and increase expressiveness -- this includes reducing coupling and increasing cohesion.
  • Run the tests again, you should still have the Green Bar. If you get the Red Bar, then you made a mistake in your refactoring. Fix it now and re-run.
  • Repeat the steps above until you can't find any more tests that drive writing new code.

     

Please note that first item is by far the most difficult, followed by the second item. The rest of the list is really pretty easy, but the first two are critical.

 

Uh, item 1 is what your OnsiteCustomer keeps screaming about, and item 2 is just item 1 stated inside-out. They are all easy, especially in this order.

 

There is a big step between hearing the words of an  OnsiteCustomer and understanding the meaning. Translating a business statement into technical language can be a difficult job and one should respect that difficulty. Item 2 recognizes that testing the code often requires exposing some things not necessarily required by the end user. There is a step to go beyond what the user needs to what the test will need.

 


 

Systems created using  CodeUnitTestFirst,  RelentlessTesting &  AcceptanceTest s might just be better designed than traditional systems. But they all certainly would support  CodeUnitTestFirstwhile using them better than our current set of systems.

 

But because so danged many of them were not, we are a little blind to what we could have available on the shelf.

 


 

A list of ways that test-first programming can affect design:

 

  • Re-use is good. Test first code is born with two clients, not one. This makes adding a third client twice as easy.
  • Refactoring test-first code results in equally tested code, permitting more aggressive refactorings (RefactorMercilessly). Cruft is not allowed, and code is generally in better shape to accept more refactorings.
  • When paying attention during all of the little steps, you may discover patterns in your code.
  • Test code is easy to write. It's usually a couple calls to the server object, then a list of assertions. Writing the easy code first makes writing the hard code easy.
  • DesignPatterns may be incremented in, not added all of a bunch up front.
  • Test-first code is written Interface first. You think of the simplest interface that can show function.
  • Code tends to be less coupled. Effective unit tests only test one thing. To do this you have to move the irrelevant portions out of the way (e.g., MockObjects). This forces out what might be a poor design choice.
  • UnitTests stand as canonical & tested documentation for objects' usage. Developers read them, and do what they do in production code to the same objects. This keeps projects annealed and on track.
  • When the developer has to write tests for what he is going to do, he is far less likely to add extraneous capabilities. This really puts a damper on developer driven scope creep.
  • Test First Design forces you to really think about what you are going to do. It gets you away from "It seemed like a good idea at the time" programming.

     

- This sure isn't a page for irresponsible people.  Is any programming activity for irresponsible people? See  CodeAndFix,  WaterFall.

 

-  Nope. the problem is:  They don't know! [ UnskilledAndUnawareOfIt]

 

I have been working my way through Kent's TDD book for a while now, and applying the principles quite rigorously. I am a real dullard sometimes, because it takes me a horribly long time to understand even simple stuff. I had probably been applying TDD for more than a week before I realized why it works so well (at least for me). There are three parts to this:

 

  • The tests (obviously) help find bugs in the application code, and the micro-steps taken with TDD mean that any "bugs" are in the very code I have just been writing and hence which still has a relevant mental model in my small brain
  • By doing the absolutely simplest thing in the application code in order to get each test to run, I often have small AhaMoments, where I see that I am writing such overly concrete code (i.e. just enough to get the tests to work) that the tests (even though they run) cannot possibly be adequate to cover the "real" requirements. So to justify writing more abstract application code, I need to add more test cases that demand that abstraction, and this forces me to explore the requirement further. Therefore, the application code actually helps me debug the tests. That is, since the tests are the specification, feedback from the application code helps me debug the specification.
  • As I have these "aha!" moments (mentioned in 2 above) I follow Kent's practice of adding them to the ToDoList. It took my stupid head quite some time to realize that the TODO list is actually a list of Micro-Stories, which I constantly prioritize (since I am the customer at this level). Following AlistairCockburn's insight that Stories are promises to have a conversation with the customer, I see, then, that the Micro-Stories in the TODO list are a promise to have a conversation with myself (and, here is the weird bit) to have a conversation with the code (since it gives me feedback - it tells me things - and TDD tunes me in to listening to the code).

     

--  AnthonyLauder

 


 

Test Driven Development (TDD) by  KentBeck

 

 

ISBN 0321146530 A Book,

 

Mailing list:  http://groups.yahoo.com/group/testdrivendevelopment.

 

Test Driven Development (TDD) by DavidAstels ?

 

ISBN 0131016490 another book

 


 

JohnRusk worries  that one danger of TestDrivenDevelopment is that developers may not take that step that you take. I.e. developers may stay with overly concrete code that satisfies the tests but not the "real" requirements.

 

To look at it another way, I have always felt that it was dangerous to approach design with (only) particular test cases in mind, since its usually necessary to think about boundary cases, and other unusual cases.

 

How does XP address that danger? By encouraging developers to write sufficiently comprehensive tests? Or by relying on developers to take that step which you mention, which is saying, "OK, this actually passes my tests, but its not really adequate for the real world because....".

 

XP addresses that danger with  PairProgramming. When obvious boundary cases are overlooked by the programmer driving the keyboard, the programmer acting as navigator points out the oversight. This is an excellent example of a case where a single practice is, by itself, insufficient to reasonably guarantee success but, in combination with a complementary practice, provides excellent results.

 

TestFirst is a cool way to program source code. XP extends TestFirst to all scales of the project. One tests the entire project by frequently releasing it and collecting feedback.

 

Q: What "real" requirements can you not test?
  • Those requirements which are not stated.
  • Requirements which requires highly specialized, unaffordable, or non-existant support hardware to test. E.g., with hardware such as the Intellasys SEAforth chips, it's possible to generate pulses on an I/O pin as narrow as 6ns under software control. To see these pulses, you need an oscilloscope with a bandwidth no less than 166MHz, and to make sure their waveform is accurate, you need a bandwidth no less than 500MHz, with 1GHz strongly preferred. However, at 1GHz bandwidths, you're looking at incredibly expensive sampling oscilloscopes. Thus, if you cannot afford this kind of hardware, you pretty much have to take it on faith things are OK. Then, you need some means of feeding this waveform data back to the test framework PC (which may or may not be the PC running the actual test), which adds to the cost.

Note: here is the link to the pdf file on the yahoo groups area: I found this unexpectedly awkward to locate by searching, so I thought I'd drop the link in here. --  DavidPlumpton

 

I've sometimes been an advocate of test driven development, but my enthusiasm has dropped after I've noticed that  CodeUnitTestFirst goes heavily against prototyping. I prefer a style of coding where the division of responsibility between units and the interfaces live a lot in the beginning of the development cycle, and writing a test for those before the actual code is written will seriously hinder the speed of development and almost certainly end testing the wrong thing.

 

Agreed. Please see my blog entry about adapting TDD for mere mortals at  http://agileskills2.org/blog/2010/02/07/tdd-adapted-for-mere-mortals/ --  KentTong

 

:  Assuming you're not shipping the prototype, there's nothing particularly in conflict. The prototype is in itself a sort of design test. The trouble with prototypes is that they have this habit of becoming the product...

 

  • [RE: prototypes becoming "the" product. Arrg.. I agree. No reason for it to happen. TDD makes rewriting slops as clean code absurdly easy]

     

Design is a lot more difficult than implementing a design. But  UnitTest s explicitly require one to define the design before making it work.

 

There are other problems, too. Like OO methodology, the difficulties which test driven development helps with are sometimes caused by itself. Every extra line of code adds to the complexity of the program, and tests slow down serious refactoring. This is most apparent in hard-to-test things like GUI's, databases and web applications, which sometimes get restructured to allow for testing and get complicated a lot. --  PanuKalliokoski

 

CodeUnitTestFirst goes heavily against prototyping? Strange, I haven't found that to be true, myself. Closer to the opposite, in fact - I start with a very thin shell of a ProtoType?, and as I make progress it fills in with real features. I wonder how what you actually do differs from what I actually do.

 

Strongly agree. A big side benefit of  CodeUnitTestFirst that doesn't get enough attention is how it rearranges your thinking. Instead of thinking "oh I'll need these accessors on these classes, etc" you think in terms of use cases. And you end up with *exactly* what you need, nothing more and nothing less.

 

I find I have a huge increase in speed in all areas of development when I CodeUnitTestFirst. I honestly believe that anyone who doesn't experience this is either busy knocking downStrawMans, isn't doing it right, or hasn't really given it a chance.

 

TDDing GUIs is quite frustrating. It may be a lot easier if there were a GUI toolkit available that has been TDDed itself, from the ground up. Anyone interested in such a TDDedGuiFramework project?

 

You mean like RubyOnRails? --PhlIp

 

:-) No, I mean a toolkit for standalone clients (or maybe a hybrid one, people have been experimenting with this already). Something like SWT, but a lot more intuitive :-)

 


 

Note that some TDDers abuse  MockObject s. Dynamic mock systems like  http://classmock.sf.net can make this too easy. A TDD design should be sufficiently decoupled that its native object work fine as stubs and test resources. They help to test other objects without runaway dependencies. One should mock the few remaining things which are too hard to adapt to testing, such as random numbers or filesystem errors.

 

Some of us disagree with that view, see  http://www.mockobjects.com/files/mockrolesnotobjects.pdf for an alternative.

 


 

I'd like to revisit a comment that  JohnRusk made above:

 

It seems to me that one danger of TestDrivenDevelopment is that developers may _not_ take that step that you take. I.e. developers may stay with overly concrete code that satisfies the tests but not the "real" requirements.

 

See  FakeItUntilYouMakeIt

 


 

The principles of TDD can be applied quite well to analysis and design, also. There's a tutorial on Test-driven Analysis & Design at http://www.parlezuml.com/tutorials/tdad/index_files/frame.htm which neatly introduces the ideas.

 

--  DaveChan

 


 

"Roman Numerals" is often held up as a good sample project to learn TDD. I know TDD but I'm bad at math, so I tried the project, and put its results here:

 

--  PhlIp

 


 

<shameless plug> Up to date info on tools and practices at  http://testdriven.com

 

--  DavidVydra

 


 

I found GNU/Unix command line option parsing to be a good TDD exercise as well. My results here:

 

--  PaulHolser
OrganicTesting of the  TgpMethodology is one way to practice  TestDrivenDevelopment. Organic Testing is an  AutomatedTest s methodology that share resemblance to both  UnitTest and IntegrationTest. Like  UnitTest, they are run by the developers whenever they want (before check-in). Unlike  UnitTest, only the framework for the test is provided by the programmers, while the actual data of the test is given by  BusinessProfessionals. In Organic testing like  IntegrationTest s, in each run the whole software (or a whole module) is activated. --  OriInbar

 

Another reference: article "Improving Application Quality Using Test-Driven Development" from Methods & Tools

 

http://www.methodsandtools.com/archive/archive.php?id=20

 


 

But what about SecureDesign ?? SecurityAsAnAfterthought ? is a bad idea and it seems that test-driven development (and a number of other agile processes, though perhaps not all) has a bad habit of ignoring security except as test cases, which isn't always the best way to approach the problem.

 

--  KyleMaxwell

 


 

Hmmmm. Seems to me that TDD deals with security (as well as things like performance) just like any other functional requirement. You have a story (or task) explicitly stating what functionality is needed (e.g., user needs 2 passwords to login, which are stored in an LDAP server; or algorithm needs to perform 5000 calculations per second). You then write tests that will verify functionality. And then you write the functionality itself.

 

And unlike traditional development, you now have regression tests to make sure that this functionality never gets broken. (i.e., if, due to subsequent coding, the security code gets broken, or the algorithm performance drops off, you'll have a broken test to alert you of that.)

 

--  DavidRosenstrauch

 

One of the reasons that security is hard is that security is not just a piece of functionality. Okay, there are things like passwords which are security features, but the rest of the code also has to not have security holes, which are NegativeRequirements ?; ie, code must not do X. This is obvious in the case of 'must not overflow buffer', which TDD does address, but is less obvious in things like 'component X should not be able to affect component Y'. How do you test that? ( I probably read this in 'Security Engineering', by Ross Anderson, which is now free on the web).

 

-- AlexBurr ?

 

In the case of "Component A must not affect Component B", how would you evaluate this without  test-driven development? If you can't formally define this requirement, then TDD is no better or worse than hoping for the best. (One answer in this case may be rule-based formal validation of the system, which is easy enough to plug into a TDD framework.) -- JevonWright ?

 


Some interesting info on test driven development from E. Dijkstra: Bit Torrent founder (Bram) uses test driven development, and thinks Formal methods suck:
IEEE Software will publish a special issue on Test-Driven Development in July 2007. For more information, see  IeeeSoftwareSpecialIssueOnTestDrivenDevelopment

 


Found this useful illustration of TDD in .NET (Flash screen cast)  http://www.parlezuml.com/tutorials/tdd.html
See  TestFirstUserInterfaces  CalvinAndHobbesDiscussTdd  TestDrivenAnalysisAndDesign  TestDrivenDevelopmentaPracticalGuide  TestDrivenDevelopmentChallenges TestDrivenDesignPhaseShift,  PowerOfTdd,  IeeeSoftwareSpecialIssueOnTestDrivenDevelopment,  BehaviorDrivenDevelopment,  TestFoodPyramid

 

《Test-Driven development By Example》阅读(三) 第十三章 万恶之源(The Root of All Evil)——去除多余子类!   1、存在的问题: (1)汇率转换问题,当汇率为2:1时,5美元 + 10法郎 = 10美元; (2)5美元 * 2 = 10美元; (3)将amount定义为私有; (4)Dollar类有副作用吗? (5)钱数为整数; (6)实现equals()函数; (7)实现hashCode()函数 阅读详情

相关推荐

测试驱动开发Kent Beck

Kent Beck的经典教程 测试驱动开发

测试驱动开发_中文版完整PDF下载

测试驱动开发_中文版完整PDF下载 【下载地址】测试驱动开发_中文版完整PDF下载 探索测试驱动开发的精髓,掌握软件工程的核心实践。本仓库提供《测试驱动开发》中文完整版PDF资源,由著名专家Kent Beck撰写。本书通过先测试后编码的方法,帮助开发者深入理解需求,优化软件架构,提升代码质量。PDF文件带书签,便于阅读与...

gitblog_06726的博客 598

C# and .NET Core Test Driven Development [2018]

Write flexible, maintainable, and verifiable code for .NET Core Write testable code using SOLID principles and dependency injections Recognize the characteristics of a good unit test Structure and group your unit test Use mock objects to handle dependencies Set up an end-to-end continuous integration process

TEST-DRIVEN DEVELOPMENT?别逗了

这篇文章来源于Peter Sergeant在Write More Test 博客上的《Test-Driven Development? Give me a break…》,在原文和Reddit 上有很大反响。这篇文章里的很多观点在《TDD并不是看上去的那么美》和《再谈敏捷和TW咨询师》里都出现过(我个人觉得我的观点比其更全面一些)。就像我转的《Scrum为什么不行》 和《Bob大叔和Jim Cop...

weixin_36841920的博客 1550

机器学习入门基础 | 基于python的高光谱图像特征挖掘:PCA + 形态学属性处理可视化实战

本文介绍了一种基于PCA和形态学操作的高光谱图像特征提取方法。通过主成分分析降低数据维度,再运用面积开闭操作增强空间结构特征,有效去除噪声并填补孔洞。实验采用WHU-HI-HanChuan数据集,提供完整的Python实现代码,包括数据加载、PCA降维、形态学处理及结果可视化等步骤。该方法能够显著改善图像质量,为后续分类和变化检测任务提供更好的特征输入。实验结果表明,不同阈值的形态学处理能呈现不同程度的空间结构增强效果,对区域生长、分割和聚类等应用具有重要价值。

lestatlu的博客 1046

QT播放器插件内嵌浏览器配合流媒体实现国标摄像头网页端播放

基本原理在浏览器⽹页中的指定播放窗口的位置和⼤⼩,实现⼀个内嵌到⽹页中显⽰的播放窗⼝,前端还必须可对这个内嵌播放窗⼝进⾏控制,⽽且播放窗⼝必须跟随浏览器窗⼝的移动和缩放、⽹页滚动、标签页切换、关闭等操作进⾏⾃动联动。播放器可以通过QT实现。这个播放窗⼝同时提供Web Socket的服务端和JSON打包命令的解析执⾏模块,前端就可以通过Web Socket连接后发送JSON打包的控制命令实现控制播放窗⼝。

cameravision的博客 562

Test-Driven Development?别逗了

此文转载自:http://coolshell.cn/articles/5531.html ——————————————正文开始—————————————— 对于程序员来说有些事有非常危险的信号(red flag)。当我听到有人开始信仰Test-Driven Development 是 One True Programming Methodology(唯一正确的编程方法论),这就是危

xiazdong 1304

算法-基于MACD的Adaboost股价涨跌预测模型

MACD是一个指标,具体用法是MACD>0看涨,反之看跌,果真是这样的吗?由于所有的技术指标都基于对历史数据的统计,指标的滞后性也就难免,有时候MACD明明大于0,股价仍然跌,有时候macd小于0,股价仍然涨。 本文基于Adaboost算法提出了一种基于macd的线性阀值分类器作为若分类器,通过在限定的解空间内寻找使得错误率最小的阀值和偏置,这样做避免了训练若分类器的复杂性,经验证,这种方法有效。

mtaxot的博客 8023

测试驱动开发 Test-driven development

测试驱动开发(Test-driven development)是极限编程中倡导的程序开发方法,以其倡导先写测试程序,然后编码实现其功能得名。 正面评价[编辑] 可以有效的避免过度设计带来的浪费。但是也有人强调在开发前需要有完整的设计再实施可以有效的避免重构带来的浪费。 可以让开发者在开发中拥有更全面的视角。 负面评价[编辑] 开发者可能只完成满足了测试的代码,而忽

1958

ClaudeCode 通过 CC Switch 配置 Ollama 本地大模型

本文介绍了如何让Claude Code使用本地免费模型qwen3.5:9b而无需Anthropic API Key的方法。主要内容包括:1)安装Claude Code、CC Switch代理工具和Ollama本地模型运行时;2)配置环境变量和设置文件将请求转发到本地服务;3)详细说明了系统架构和工作原理,展示请求如何从Claude Code经CC Switch代理到Ollama本地模型。该方案通过代理拦截和转发机制,实现了使用免费开源模型替代官方API的功能。

稚枭天卓 3221

【代码审计】RuoYi定时任务漏洞:从SQL注入到RCE的攻防演变

本文深入剖析了RuoYi框架定时任务模块从早期版本无校验到引入黑白名单机制,再到被组合利用实现RCE的完整漏洞演变过程。文章详细分析了SQL注入与定时任务功能结合导致的远程代码执行漏洞,并总结了代码审计与安全开发的核心要点,为开发者提供了重要的安全参考。

yellow的专栏 699

test driven development读后感

test driven development读后感 由测试到开发,执行所有的测试,失败修改,知道全部通过,重构,消除重复部分。 posted on 2014-03-20 10:32 yoyo_zeng 阅读(...) 评论(...) 编辑 收藏 var allo...

weixin_33890499的博客 114

从DDH到FastANI:原核生物分类黄金标准的进化史与技术对比

本文系统梳理了原核生物分类标准从DDH到FastANI的四次技术革命,详细解析了95%相似度阈值的科学依据及应用场景。通过对比DDH、16S rRNA、ANI和FastANI的技术特点与性能指标,为微生物研究者提供基因组分类的实战指南,并展望第三代测序时代的分类新挑战。

weixin_29275257的博客 413

Mastering React Test-Driven Development:掌握React测试驱动开发的利器

Mastering React Test-Driven Development:掌握React测试驱动开发的利器 项目介绍 在现代前端开发中,React框架因其组件化、声明式编程的特点受到了广泛欢迎。然而,随着项目规模的扩大,如何确保代码质量、提升开发效率成为了开发者关注的焦点。《Mastering React Test-Driven Development》正是针对这一问题,提供了一套系统的Re...

gitblog_00557的博客 992

【YOLO系列】YOLOv4详解:模型结构、损失函数、训练方法及代码实现

摘要:YOLOv4在目标检测领域实现了精度与速度的平衡,通过CSPDarknet53骨干网络、SPP+PANet特征融合及CIoU损失函数等创新,在MS COCO数据集达到65.7% AP50,V100显卡实现62FPS实时检测。核心优化包括Mosaic数据增强、自对抗训练和解耦头结构,显著提升小目标检测和遮挡场景鲁棒性。代码实现采用CSP模块和SPP多尺度池化,兼顾计算效率与检测性能,为工业落地提供高效解决方案。(149字)

一碗白开水一 1358

RH850从0搭建Autosar开发环境【2】- Davinci Configurator配置工程导入DBC与CDD文件

Davinci Configurator配置工程导入DBC与CDD文件,开始Autosar开发

weixin_42412049的博客 8153

什么是测试驱动开发(Test-Driven Development)

        不怕被大家笑话,刚才同事手上拿到《测试驱动开发实用指南》这本书时,我还以为是驱动开发方面的书籍呢,仔细翻了一下才知道不是。这本书的英文名称是《Test-Driven Development》,这里的Driven是动词,书名的意思是由测试来带动开发。那什么是Test-Driven Development,在我看来这是一种开发方式,是一种编程理念。就像作者说的一样。他比咖啡因更容易让人

syspro的专栏 3850

visio安装包

Microsoft Office Visio 是一款专业的制图软件。利用经过更新的形状、协作工具和数据链接图表,创建专业级图表以简化复杂的信息。

翻译 Test-Driven Development in Microsoft .NET

自去年开始,我就翻译Test-Driven Development in Microsoft .NET>>( by James W. Newkirk and Alexei A. Vorontsov  Microsoft Press © 2004)当时,翻译这本书:主要有一下几个目的:1)出于兴趣2)学习TDD3)也就是别把英语给忘了4)学习学习大师们如何实现软件系统的5)学习大师们如何写书的6)理

Making Best Use Of Anything,Creating Most Value! 1242

android 蓝牙通讯demo

android 下蓝牙通讯demo,实现了发现蓝牙,使能蓝牙,通过蓝牙发送消息。

大中型超市收银系统(可直接运行)

光步前台收银系统系统功能:商品销售、商品退货、挂单、收银员权限、会员销售、单品取消、整单取消、商品查询、脱机销售、脱机数据上传,基本资料下载,开钱箱、小票打印、收款结算,支持多币种付款方式(现金、储值卡、礼券、微信等),支持多种促销。运行环境:.net 4.0登陆信息用户名:1001 密码:123456内置商品信息,商品编码可输入00001000 - 00010000,测试效果相关功能键F5 结算 F9挂单 F11商品查询 F8退货 Insert单品取消 Del整单取消 F12开钱箱F2 会员 Ctrl+Z退出系统 Home 锁屏 相关源码待公开

在看Test-Driven Development In Microsoft .NET

《Test-Driven Development In Microsoft .NET》,这本书就是一本实例说明的书。 TDD的话,开始读过的那本大作《敏捷软件开发:原则、模式与实践》,感觉还好。 因为这种书籍翻译起来,挺难的,这本只有三分一是晦涩的,很不错了。晦涩的那些部分基本上是怎么看都不懂。 《Test-Driven Development In Microsoft .NET》原版看起来...

weixin_30511039的博客 158

[PHP]用PHPUnit进行测试驱动开发(Test-Driven Development)

单元测试是软件开发过程中极其重要的一部分,几个著名的软件开发实践都推崇以单元测试为主导:Test-First Programming, Extreme Programming(XP极限编程), Test-Driven Development(TDD,敏捷方法的核心实践).它们也允许那些即使在语言结构上并不支持这种方法论的编程语言使用Design-by-Contract(契约式设计)。你可以在你开发...

weixin_30399055的博客 162

今天开始读Test-Driven Development - A Practical Guide 里的例子

今天开始读里的例子。打算边读边把里边的例子用C++写一遍。

Welcome to cpluser's blog 1203

Test Driven Development感悟

编程的思想有面向过程编程、面向对象编程、面向接口编程。面向接口编程是现在很多公司在使用的,面向接口效率更好,而且使得业务代码更加简洁易调试。面向对象的方法使得代码会多出很多接口,可以为以后的使用留接口,但是开发效率不高。面向过程写代码,可以比较快的完成任务,但是之后要再修改复用就很浪费时间,要改很多东西。所以现在我写代码为了在面向对象和面向过程中权衡,我会选择面向接口编程。 在写代码的过程中,需要...

I AM BACK 476

agent-skills 实战:用 test-driven-development 让 AI coding agent 可验证

AI coding agent 的核心挑战在于生成代码后缺乏运行时验证,容易产生看似正确但实际不可用的结果。test-driven-development 通过先定义测试标准再执行实现的闭环机制,为 agent 提供了可验证的工程约束。agent-skills 将这一思路标准化为结构化技能文件,使 Claude Code 等工具能够按明确步骤执行任务,而非依赖模型猜测。在接口开发、bug 修复等场景中,这种技能化方法显著提升了首次生成正确率,减少了人工干预。理解任务拆解与验证闭环,是构建可靠 agent 工

weixin_29054399的博客 294

Test-Driven Development

Test-Driven Development (TTD) suggests that tests express the requirements with which the code must comply. This technique requires developers to write an automated unit test before writing feature code. As feature code evolves, automated tests provide imm

Neil Wang的专栏 534
上一篇: 每天写出好代码的5个建议
下一篇: Category Testing
Qicz
博客等级 码龄16年 56粉丝 122原创
评论
成就一亿技术人!
拼手气红包6.0元
还能输入1000个字符
 
 条评论被折叠 查看
添加红包

请填写红包祝福语或标题

个

红包个数最小为10个

元

红包金额最低5元

当前余额3.43元 前往充值 >
需支付:10.00元
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付元
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值