How to do test driven develoment for Joomla componentsTDD TDD Joomla component Test driven develoment
Test Driven Development is very important to improve quality and reduces bugs in your code. In this article I will show you how to use TDD in developing Joomla component. First you have to install phpunit, you can find the details at here. In this article we will use Joomla article manager (com_content) component as an experiment, and this article is based on Joomla 3.2.0. Here are the steps:
1. Create a Test folder
Create a new folder called Tests on /joomlapath/administrator/components/com_content folder. This folder will contain all test files.
2. Create phpunit configuration file
Create a new file called phpunit.xml. we will use the following configurations for this experiment:
<phpunit bootstrap="bootstrap.php" colors="true" convertErrorsToExceptions="true" convertNoticesToExceptions="true" convertWarningsToExceptions="true" processIsolation="false" stopOnFailure="false" syntaxCheck="false" verbose="true"> </phpunit>