CodeIgniter Forums
Unit Testing and Continuous Integration - Printable Version

+- CodeIgniter Forums (https://forum.codeigniter.com)
+-- Forum: Using CodeIgniter (https://forum.codeigniter.com/forumdisplay.php?fid=5)
+--- Forum: Best Practices (https://forum.codeigniter.com/forumdisplay.php?fid=12)
+--- Thread: Unit Testing and Continuous Integration (/showthread.php?tid=65765)



Unit Testing and Continuous Integration - ComputingFroggy - 07-21-2016

Hi,

I want to add Unit testing to my CI projects.
I have seen there is ci-phpunit-test from kenjis.

It seems nice however I came across TOAST and I quite like the 5 criteria that led to its creation:
  1.    It must be lightweight a completely unobtrusive - I don't want a lot of bloat or a ton of files littering my CI installation
  2.    It must integrate perfectly with CI - ie. no hacking the core, no intricate workarounds to make it work inside CI Controller classes, and no duplicate index.php files
  3.    It must use simple JUnit-like syntax (meaning it must support a range of assert_*() functions)
  4.    It must work entirely in the browser - I don't always have shell access to my servers, and you might not either
  5.    It must offer a simple way to run both individual tests, groups of tests, and all tests at once

I am not sure that ci-phpunit-test matches number 4.

What are your thoughts about Unit Testing ? What tools do you use ?

Going forward I want to perform continuous integration: any experiences on that ? I am thinking of using Jenkins.


Cheers,
L.


RE: Unit Testing and Continuous Integration - mwhitney - 07-22-2016

I'm probably a little biased on this, having worked on CodeIgniter Testing Guide with Kenji. I think the whole premise of #4 is problematic, because you shouldn't be running tests in your production environment (except perhaps before it goes live), and it usually isn't difficult to have access to the CLI at least in your development environment.

Anyway, while I haven't attempted it, it should be possible to implement a browser interface to run tests through PHPUnit/ci-phpunit-test installed.


RE: Unit Testing and Continuous Integration - kenjis - 07-23-2016

Hi,

If you really value #1, ci-phpunit-test does not fit you.
Because ci-phpunit-test includes thrid-party libraries, now it has 294 php files in the Zip archive.
And more, you need to install PHPUnit.

About #4, you can run ci-phpunit-test/phpunit via your browser if you use VisualPHPUnit.