Simpletest Integration for CodeIgniter
Clone or download
Fetching latest commit…
Cannot retrieve the latest commit at this time.

CodeIgniter with SimpleTest


The CodeIgniter core is now being converted to using phpUnit so I'm using simpletest as a stopgap measure.

In additon to the origional version I've added the ability to output the test results in Junit format for use in continuous integration systems based on work from


This has been adopted from: jamieonsoftware

With help from: John S. -

Design From: Istvan Pusztai -


The unit_test.php file should go in your CodeIgniter root. The same place as index.php

You should open that file and alter your paths at the top.

The tests directory can be moved any where you want but they are setup to be in the root as well.

All test files need to be named test_name_folder.php. For example:


I have included a full download of simpletest and the only customization I have made is to the simpletest/extensions/my_reporter.php.


Once you have installed you can either run tests through the browser or via command line.

  • Browser - Visit
  • Command Link - $ php unit_test.php
  • XML Results - $ php unit_test_xml.php


Inside the "tests" directory I include two example test files. The test_users_model.php will not run on its own because your application would not include the same users model as the example file. It is supplied just as a guide.

This version is now compatible with PHP 5.3