Should I use CodeIgniter Unit Testing Class or PHPUnit / TOAST?

I am looking for good unit testing for my web development. I use CodeIgniter for PHP and I found this class in the CodeIgniter documentation, so I doubt it:

Should I use the "Unit Testing Class" to test my code, or is it better to use PHPUnit or TOAST ? Which is better and why?

I hope someone experienced can help me. Thanks!

+8
php unit-testing codeigniter testing
source share
4 answers

In my opinion, I think it's better to use standard PHPUnit for unit testing.

In addition, it has many nice features, your tests will be more consistent, and it does not depend on the CakePHP module testing class.


If in the future you decide CakePHP does not meet your needs, you will lose your unit tests. (or, say, you have to transfer them, which is time)

If you are testing code, it depends on CakePHP (Controller, Model, etc.), there is no problem using CakePHP tests, but for any other case, I think you should bet on the more popular unit test package, which can ( Phpunit )

Happy testing :)

+9
source share

I have not conducted any tests using the codeignitor assembly in the unit test class. but it seems that this class provides only a very simple statement function (perhaps because of the desire for the easy one), and the worst thing is that you need to ruin the testing code using your production code.

For unit test, it offers much more approval functions, more features: for example, code coverage, RC selenium ... etc. therefore, it can expand your ability to provide quality code. another advantage is that it does not depend on any code in your infrastructure, so you can easily migrate.

+1
source share

Unit Testing Class is a fairly simple test suite. If you need complete testing of your code, use PHPUnit .

0
source share

Codeigniter has its own module testing function.

Go to http://codeigniter.com/user_guide/libraries/unit_testing.html

thanks

-2
source share

All Articles