当前位置:网站首页>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)
边栏推荐
- Custom attribute access__ getattribute__/ Settings__ setattr__/ Delete__ delattr__ method
- Tomb. Weekly update of Finance (February 7 - February 13)
- My C language learning record (blue bridge) -- under the pointer
- 有没有完全自主的国产化数据库技术
- Microsoft Research, UIUC & Google research | antagonistic training actor critic based on offline training reinforcement learning
- 张丽俊:穿透不确定性要靠四个“不变”
- Jenkins basic knowledge ----- detailed explanation of 03pipeline code
- My C language learning records (blue bridge) -- files and file input and output
- 华为、H3C、思科命令对比,思维导图形式从基础、交换、路由三大方向介绍【转自微信公众号网络技术联盟站】
- Leetcode problem solving -- 173 Binary search tree iterator
猜你喜欢
深入刨析的指针(题解)
[unity3d] GUI control
IPv6 comprehensive experiment
Misc (eternal night), the preliminary competition of the innovation practice competition of the National College Students' information security competition
#PAT#day10
Mysql database operation
What is the investment value of iFLYTEK, which does not make money?
[network security interview question] - how to penetrate the test file directory through
Microsoft Research, UIUC & Google research | antagonistic training actor critic based on offline training reinforcement learning
SAP ALV颜色代码对应颜色(整理)
随机推荐
如何做好功能测试
Derivation of anti Park transform and anti Clarke transform formulas for motor control
MySQL advanced notes
这些不太会
多态day02
Some problem records of AGP gradle
【Kubernetes 系列】一文學會Kubernetes Service安全的暴露應用
The real machine cannot access the shooting range of the virtual machine, and the real machine cannot Ping the virtual machine
银行核心业务系统性能测试方法
How to do function test well
C # create self host webservice
记录一下逆向任务管理器的过程
Descriptor implements ORM model
EDCircles: A real-time circle detector with a false detection control 翻译
Erreur de la carte SD "erreur - 110 whilst initialisation de la carte SD
Jenkins basic knowledge ----- detailed explanation of 03pipeline code
Prototype design
Software design principles
What is the investment value of iFLYTEK, which does not make money?
Eight super classic pointer interview questions (3000 words in detail)