当前位置:网站首页>Yyds dry inventory what is test driven development
Yyds dry inventory what is test driven development
2022-07-06 03:15:00 【A drop in the universe】
Definition
Test-driven development , English name Test-driven development, It's about a programming style .
There are mainly three processes closely intertwined :
- code
- test ( In the form of writing unit tests )
- Design ( In the form of refactoring )
It can be succinctly described by the following set of rules :
- Write a unit test , To describe one aspect of the program
- Run the test , If the program lacks functions, it will fail
- To write “ Adequate ” Code for , As simple as possible , To make the test pass
- “ Refactoring code ”, Until it meets the simplicity criteria
- repeat , as time goes on “ The accumulation of ” unit testing
Expected revenue
If you do this, you may reap benefits :
- Team code bug A significant reduction in the rate , But the code is a modest increase in the initial development work
- The same team reported that these indirect costs were offset by a reduction in work at the final stage of the project
- Although empirical studies so far have failed to confirm this , But senior practitioners report ,TDD It can improve the design quality in the code , And more generally improve “ Inside ” Or technical quality , For example, improve the indicators of cohesion and coupling
Common pitfalls
Typical personal mistakes include :
- Forget to run tests often
- Write too many tests at once
- Write tests that are too large or too coarse
- Write too trivial tests , For example, omit assertions
- Write tests for trivial code , For example, accessors
Typical team misconceptions include :
- Partial use of —— Only a few developers on the team use TDD
- The test suite is poorly maintained -- The most common reason is that the test suite runs too long
- Obsolete test suite ( That is, it rarely or never runs )-- Sometimes due to poor maintenance , Sometimes it is caused by the flow of team personnel
origin
Although the idea of testing and refinement before programming is not the original idea of the agile community , but TDD Constitutes a breakthrough , Because it combines this idea with “ Developer testing ” The idea of combining , It provides new respect for developer testing .
- 1976 year :Glenford Myers Published “ Software reliability ”, Which point out that “ Developers should not test their own code ” Of “ axiom ”( The dark age of developer testing )
- 1990: With “ Black box ” Technology based testing discipline , Especially with “ Capture and playback ” Form of test tool
- 1991 year : stay Taligent Independently created a testing framework , And SUnit There are amazing similarities ( source :SUnit).
- 1994 year :Kent Beck by Smalltalk Write the SUnit The test framework ( source )
- 1998: The article about extreme programming mentioned “ We usually write tests first ”( source )
- 1998 Year to 2002 year :“Test First” Elaborated as “Test Driven”, Especially in C2.com Wiki On
- 2000: Simulation object is one of the new technologies developed in that period ( source )
- 2003 year :Kent Beck Published “ Test-driven development : Example ”
To 2006 year ,TDD It is already a relatively mature discipline , It has begun to encourage further innovation derived from it , Such as ATDD or BDD).
The logo used
- “ Code coverage ” Is to prove the use of TDD The common method of ; Although high coverage does not guarantee correct use TDD, But lower than 80% Coverage of may indicate that the team is interested in TDD Insufficient mastery of
- The version control log should show that the test code is checked in every time the product code is checked in , The quantity is roughly the same
Technical level
beginner
- Be able to write a unit test before writing the corresponding code
- Be able to rewrite code enough to pass failed tests
intermediate
- practice “ Test driven bug fixes ”: When defects are found , Write a test that exposes defects before correcting
- It can decompose the characteristics of a composite program into several unit test sequences to write
- Know and be able to say some strategies to guide the writing of tests ( for example ," When testing a recursive algorithm , First write a test for recursive termination ").
- Be able to find reusable elements from existing unit tests , Test tools that generate specific situations
senior
- Be able to develop planned unit tests for macro features " The roadmap "( And modify it if necessary )
- can " Test drive " Various design paradigms : object-oriented 、 Functionalization 、 Event driven
- can " Test drive " Various technical fields : Calculation 、 The user interface 、 Persistent data access .......
Extended reading
Test Driven Development: By Example, by Kent Beck
Link to the original text :https://www.agilealliance.org/glossary/tdd/#q=~(infinite~false~filters~(postType~(~'page~'post~'aa_book~'aa_event_session~'aa_experience_report~'aa_glossary~'aa_research_paper~'aa_video)~tags~(~'tdd))~searchTerm~'~sort~false~sortDirection~'asc~page~1)
边栏推荐
- Zhang Lijun: penetrating uncertainty depends on four "invariants"
- JS regular filtering and adding image prefixes in rich text
- Function knowledge points
- mysqldump数据备份
- 【Kubernetes 系列】一文學會Kubernetes Service安全的暴露應用
- Résumé des méthodes de reconnaissance des caractères ocr
- Huawei, H3C, Cisco command comparison, mind map form from the basic, switching, routing three directions [transferred from wechat official account network technology alliance station]
- 指针笔试题~走近大厂
- Tomb. Weekly update of Finance (February 7 - February 13)
- 银行核心业务系统性能测试方法
猜你喜欢
![[pointer training - eight questions]](/img/fd/1aa3937548a04078c4d7e08198c3a8.png)
[pointer training - eight questions]

Overview of OCR character recognition methods

The next industry outlet: NFT digital collection, is it an opportunity or a foam?

three.js网页背景动画液态js特效

Problems encountered in 2022 work IV

深入刨析的指针(题解)

JS音乐在线播放插件vsPlayAudio.js

1.16 - 校验码

Web security SQL injection vulnerability (1)

Computer graduation project asp Net fitness management system VS development SQLSERVER database web structure c programming computer web page source code project
随机推荐
[ruoyi] set theme style
JS音乐在线播放插件vsPlayAudio.js
The difference between sizeof and strlen in C language
2022工作中遇到的问题四
Item 10: Prefer scoped enums to unscoped enums.
Eight super classic pointer interview questions (3000 words in detail)
Single instance mode of encapsulating PDO with PHP in spare time
Erreur de la carte SD "erreur - 110 whilst initialisation de la carte SD
【paddle】加载模型权重后预测报错AttributeError: ‘Model‘ object has no attribute ‘_place‘
Microsoft Research, UIUC & Google research | antagonistic training actor critic based on offline training reinforcement learning
How to choose PLC and MCU?
Differences and application scenarios between resulttype and resultmap
SAP ALV单元格级别设置颜色
1003 emergency (25 points), "DIJ deformation"
My C language learning record (blue bridge) -- on the pointer
[ruoyi] enable Mini navigation bar
Redis cache breakdown, cache penetration, cache avalanche
How to write compile scripts compatible with arm and x86 (Makefile, cmakelists.txt, shell script)
Era5 reanalysis data download strategy
Technology sharing | what if Undo is too big