CodeIgniter Tutorial : How to Using Unit Testing in CodeIgniter
Unit testing, especially test driven development, is a design or implementation activity, not a testing activity.
You get two primary benefits from unit testing, with a majority of the value going to the first:
1. Guides your design to be loosely coupled and well fleshed out. If doing test driven development, it limits the code you write to only what is needed and helps you to evolve that code in small steps.
2. Provides fast automated regression for refactors and small changes to the code.
Available Example Code : https://goo.gl/cihl9K
source