Unit Testing

In computer programming, Unit Testing is a software testing method by which individual units of source code, sets of one or more computer program modules together with associated control data, usage procedures, and operating procedures are tested to determine if they are fit for use.1

Unit Tests are primarily written as a good practice to help developers identify and fix bugs, to refactor code and to serve as documentation for a unit of software under test. To achieve these benefits, unit tests ideally should cover all the possible paths in a program. One unit test usually covers one specific path in one function or method. However a test method is not necessary an encapsulated, independent entity. Often there are implicit dependencies between test methods, hidden in the implementation scenario of a test. --Adrian Kuhn et. al.2

Test Driven Development (TDD) is a software development process that relies on the repetition of a very short development cycle: first the developer writes a failing automated test case that defines a desired improvement or new function, then produces code to pass that test and finally refactors the new code to acceptable standards. Kent Beck, who is credited with having developed or 'rediscovered' the technique, stated in 2003 that TDD encourages simple designs and inspires confidence.3

PHP Unit Testing


PHPUnit is a programmer-oriented testing framework for PHP. It is an instance of the xUnit architecture for unit testing frameworks.4

PHPUnit Basics Part1

PHPUnit Basics Part2

Python / Django Unit Testing

Harry Percival - TDD with Django, from scratch: a beginner's intro to testing and web development

O'Reilly Webcast: TDD Web Development from Scratch with Python

1 Unit testing. (2014, May 22). In Wikipedia, The Free Encyclopedia. Retrieved 00:49, June 13, 2014, from http://en.wikipedia.org/w/index.php?title=Unit_testing&oldid=609698259
3 Test-driven development. (2013, October 9). In Wikipedia, The Free Encyclopedia. Retrieved 03:04, October 13, 2013, from http://en.wikipedia.org/w/index.php?title=Test-driven_development&oldid=576503904

Last edited by MichaelAlber .
Page last modified on Wednesday June 26, 2019 19:34:48 UTC.