On our development team, we decided to give Unit Testing a try. We use Simpletest. However, it s been a tough road. After a week, I only have created 1 unit test that tests a certain helper file. That s it. The rest (controllers, models, views, libraries) don t have unit tests yet. And I plan to not test a majority of them. Views, for example, are too trivial to test, so I pass up on testing that. Next, the controllers. I plan my controllers to not do complex stuff, so that it only does passing of information between the models and the views. I d move those more complex stuff to libraries or helpers.
Now for my questions:
1) Am I doing it wrong? So far, there s nothing more that I can see that can be erroneous so it would need a unit test. Most of the stuff (right now) are just CRUD.
2) Do we really need to unit test controllers? Since a controller s job is just minor processing of data passed between View and Model, I find very little initiative in unit testing it.
3) If I use WebTestCase to test for controllers, would that be still considered a Unit Test? Or is it already an integration test?
4) Suppose you got me to test my controller, how would I test it? As far as I know, CI follows the Front Controller pattern through index.php, so how would I handle (mock?) that?