当前位置:网站首页>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)
边栏推荐
- The real machine cannot access the shooting range of the virtual machine, and the real machine cannot Ping the virtual machine
- Eight super classic pointer interview questions (3000 words in detail)
- codeforces每日5题(均1700)-第六天
- Leetcode problem solving -- 108 Convert an ordered array into a binary search tree
- These are not very good
- Overview of OCR character recognition methods
- Data and Introspection__ dict__ Attributes and__ slots__ attribute
- Mysql database operation
- 如何做好功能测试
- 【paddle】加载模型权重后预测报错AttributeError: ‘Model‘ object has no attribute ‘_place‘
猜你喜欢
Overview of OCR character recognition methods
JS regular filtering and adding image prefixes in rich text
IPv6 comprehensive experiment
My C language learning records (blue bridge) -- files and file input and output
如何做好功能测试
[pointer training - eight questions]
【Kubernetes 系列】一文学会Kubernetes Service安全的暴露应用
Misc (eternal night), the preliminary competition of the innovation practice competition of the National College Students' information security competition
three.js网页背景动画液态js特效
真机无法访问虚拟机的靶场,真机无法ping通虚拟机
随机推荐
Computer graduation project asp Net fitness management system VS development SQLSERVER database web structure c programming computer web page source code project
Zhang Lijun: penetrating uncertainty depends on four "invariants"
MPLS experiment
Who is the winner of PTA
js凡客banner轮播图js特效
JS regular filtering and adding image prefixes in rich text
resulttype和resultmap的区别和应用场景
Overview of OCR character recognition methods
February 14, 2022 Daily: Google long article summarizes the experience of building four generations of TPU
电机控制反Park变换和反Clarke变换公式推导
Taobao focus map layout practice
Installation and use tutorial of cobaltstrike-4.4-k8 modified version
Analyze menu analysis
【 kubernets series】 a Literature Study on the Safe exposure Applications of kubernets Service
. Net 6 and Net core learning notes: Important issues of net core
Getting started with applet cloud development - getting user search content
[ruoyi] enable Mini navigation bar
张丽俊:穿透不确定性要靠四个“不变”
4. File modification
手写数据库客户端