PHP Unit Testing Framework
Encyclopedia

Purpose

The purpose of this framework is to drive down the costs associated with developing PHP
PHP
PHP is a general-purpose server-side scripting language originally designed for web development to produce dynamic web pages. For this purpose, PHP code is embedded into the HTML source document and interpreted by a web server with a PHP processor module, which generates the web page document...

 software by enabling developers to discover bugs at the earliest stage. These costs are:
  • Time - Finding a bug later in the software development life cycle requires more time to find its location
  • Man power - Finding bugs later in the development life cycle can and does require more human effort to find them
  • Project impact - Show stoppers found late in a project can have a disproportionate impact.


Also it enables the developer to take more pride in the software that they develop because the developer can have a higher confidence that the software functions as to be expected and has evidence for this.

Architecture

To remove the complications of trying to test software (that needs to be integrated) through a web server this framework uses the command line interface. This enables individual classes to be tested thoroughly before they are integrated together.

The PHP Unit Testing Framework generates reports in either XML
XML
Extensible Markup Language is a set of rules for encoding documents in machine-readable form. It is defined in the XML 1.0 Specification produced by the W3C, and several other related specifications, all gratis open standards....

, XHTML
XHTML
XHTML is a family of XML markup languages that mirror or extend versions of the widely-used Hypertext Markup Language , the language in which web pages are written....

 or ASCII
ASCII
The American Standard Code for Information Interchange is a character-encoding scheme based on the ordering of the English alphabet. ASCII codes represent text in computers, communications equipment, and other devices that use text...

.

The PHP Unit Testing Framework is one of the xUnit
XUnit
Various code-driven testing frameworks have come to be known collectively as xUnit. These frameworks allow testing of different elements of software, such as functions and classes...

 family of unit testing frameworks. A variety of assertions are available.

The code

The framework is written in PHP
PHP
PHP is a general-purpose server-side scripting language originally designed for web development to produce dynamic web pages. For this purpose, PHP code is embedded into the HTML source document and interpreted by a web server with a PHP processor module, which generates the web page document...

 with Doxygen
Doxygen
Doxygen is a documentation generator for multiple programming languages.Doxygen is a tool for writing software reference documentation. The documentation is written within code, and is thus relatively easy to keep up to date...

comments - so it is easily enhanced. A tutorial of how to use it is given on the official web site.

Future development

The following items are on the road map for future developments:
  • Expand the assertions that are available
  • Implement code coverage
  • Implement a mechanism to simulate execution from a server
The source of this article is wikipedia, the free encyclopedia.  The text of this article is licensed under the GFDL.
 
x
OK