2015年5月22日星期五

Nate Krantz: How I'm Writing Unit / Functional Tests


In a recent post Nate Krantz has shared some of his own methods around writing functional and unit tests.



So...testing. That thing that everyone says is so important but you don't really learn about it in school. I've had some trials and tribulations with testing so I'm going to just dump out some thoughts here.


He starts with a bit of background on his own experiences in development and how he finally decided that testing would "solve everything". He started with unit tests (for a CodeIgniter application) and how he got them up and running. He talks about issues he found around dependencies (and static methods) and how he made use of mocks to reduce some of the issues with dynamic loading, at least how CodeIgniter does it. Unfortunately, this didn't work out as planned so he fell back to a test database and create more effective and simpler functional tests. Code examples are sprinkled through out the post to show how he was trying to solve the problem at different points in the process.


Link: http://www.natekrantz.com/why-test-driven-development-rocks-sucks/

没有评论:

发表评论