当前位置:网站首页>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)
边栏推荐
- Installation and use tutorial of cobaltstrike-4.4-k8 modified version
- Audio-AudioRecord Binder通信机制
- JS regular filtering and adding image prefixes in rich text
- Polymorphic day02
- 手写数据库客户端
- Game theory matlab
- Apt installation ZABBIX
- [kubernetes series] learn the exposed application of kubernetes service security
- Distributed service framework dobbo
- NR modulation 1
猜你喜欢
C # create self host webservice
八道超经典指针面试题(三千字详解)
Research on cooperative control of industrial robots
1. Dynamic parameters of function: *args, **kwargs
OCR文字识别方法综述
SAP ALV颜色代码对应颜色(整理)
Résumé des méthodes de reconnaissance des caractères ocr
Tomb. Weekly update of Finance (February 7 - February 13)
ERA5再分析资料下载攻略
Performance analysis of user login TPS low and CPU full
随机推荐
Microservice registration and discovery
Microsoft Research, UIUC & Google research | antagonistic training actor critic based on offline training reinforcement learning
Deep parsing pointer and array written test questions
MySQL advanced notes
Audio audiorecord binder communication mechanism
Computer graduation project asp Net fitness management system VS development SQLSERVER database web structure c programming computer web page source code project
下一个行业风口:NFT 数字藏品,是机遇还是泡沫?
tcpdump: no suitable device found
如何做好功能测试
OCR文字識別方法綜述
Fault analysis | analysis of an example of MySQL running out of host memory
出现Permission denied的解决办法(750权限谨慎使用)
[Li Kou] the second set of the 280 Li Kou weekly match
Buuctf question brushing notes - [geek challenge 2019] easysql 1
【若依(ruoyi)】ztree 自定义图标(iconSkin 属性)
IPv6 jobs
Lua uses require to load the shared library successfully, but the return is Boolean (always true)
XSS challenges绕过防护策略进行 XSS 注入
How to do function test well
. Net 6 and Net core learning notes: Important issues of net core