are low-level, focusing on a small part of the software system. Secondly unit tests are usually written these days by the programmers themselves using their regular tools - the only difference being the use of some sort of unit testing framework. Thirdly unit tests are expected to be significantly faster than other kinds of tests. — Martin Fowler 3 CC BY-NC 4.0 Justin Yost
of units of code, typically at the function/method level in PHP and C type languages. • Unit tests are written in the same language you write your code in (though you may include a test framework). • Should be fast, they shouldn't slow down your process for writing code. 4 CC BY-NC 4.0 Justin Yost
programmer's intent. • Verify bugs are solved today and in the future (Regressions). • Create better designed software. • Improve Refactoring 5 CC BY-NC 4.0 Justin Yost
• Isn't unit testing going to slow me down? • No one cares? • Business/Manager/Client/etc won't let me spend time on this stuff. 6 CC BY-NC 4.0 Justin Yost
hitting refresh • Computers do repetitive stuff really well • You forget • You make mistakes • You are bad at remembering what you tested • You are bad at communicating needed tests to other co-workers 7 CC BY-NC 4.0 Justin Yost
pre-release defect density of the four products decreased between 40% and 90% relative to similar projects that did not use the TDD practice. Subjectively, the teams experienced a 15–35% increase in initial development time after adopting TDD. — Realizing quality improvement through test driven development: results and experiences of four industrial teams http:/ /research.microsoft.com/en-us/groups/ese/nagappan_tdd.pdf 9 CC BY-NC 4.0 Justin Yost
slower in the initial learning, phase, so is the new framework, so is the new language, so is everything • The speed improvements in the long run will be worth it • The short improvements in loss of defects will easily be worth it 10 CC BY-NC 4.0 Justin Yost
code that proves what you did works • Unit Testing means you stay in the flow of the code you are working on longer • Unit Testing means you spend less time debugging and figuring out what went wrong • Unit Testing means you spend time thinking through your code 16 CC BY-NC 4.0 Justin Yost
be perfect • None of these may the right answer • You should do it because you care about producing quality software • If you don't learn now, what happens when you really need it? 17 CC BY-NC 4.0 Justin Yost