Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Intended use of the Unit Testing built in to CodeIgniter

In most framework unit testing implementations, you have a set of a tests and you execute those tests from a single [console] command. The tests run and a result is given. That result varies but generally it includes pass / fail.

CodeIgniter’s unit testing framework appears different and I have noticed an extensive collection of random tack-on-projects to either enhance or replace the CodeIgniter unit testing framework.

My question is this: What is the intended work flow or use of the unit testing framework built in to CodeIgniter?

I read the documentation; I get it. It’s a simple class. But where does one utilize the class?

For example, do all the tests go in to a single “test” controller? Or do the tests get intermingled in to each controller? Then there is the question of the models and custom helpers... Also, I'm assuming tests are run via a browser (or the alike) request...

Thanks for the guidance!

Regards,
Frank

like image 440
Frank V Avatar asked Nov 10 '10 15:11

Frank V


1 Answers

I've received an answer from another source and I want to post it here since I am aware of it.

The basic answer is that the CI (CodeIgniter) unit test class is not intended like a traditional unit test suite (JUnit, NUnit, or python's unittest). In CI, the class is intended to be used within the target (the testing target's code base).

To be clear: I'm not endorsing this nor am I sure this is the intended use of the CI unit_test class. This is just what I was told thus far. Perhaps others heard this too and can vote it up. If this is voted up or has support via comments, I'll mark this as an answer. I am still interested in differing opinions.

like image 112
Frank V Avatar answered Oct 14 '22 00:10

Frank V