Testing Methods That Make Static Calls

I had trouble testing a particularly painful codebase. It had static calls and implicit dependencies all over the place, to name just a few problems. One of the things that it often did was to call static methods that would increment counters in the database and cache stuff. Example: Record::incrementViews() It was making things difficult. To avoid messing with the…

Read More

Full Test Coverage is Impractical

Many developers claim that to achieve high quality software, developers must create automated tests that ensure that all possible execution routes have been covered. This is also known as full path coverage. I will argue that different types of software require different testing approaches and that full path coverage is impractical in almost every case…

Read More

Define: Functional, Unit and Integration Tests

I have recently read a blog post claiming that functional tests are not “true” tests. The author also claims that unit testing shows you where the problem is occurring, while functional testing simply identifies that a problem exists. This argument is deceptive and the conclusion dangerous. Different kinds of tests are not mutually exclusive. One…

Read More

You Don’t Become a TDD Expert Overnight

Do you want to write unit tests but don’t know where to begin? Don’t panic and follow these steps to ease into the testing business. Practice testing often to achieve best results. Tip: try to test the smallest unit possible, usually a function, rather than a combination of functions. Testing combinations is called integration testing,…

Read More