Welcome Guest, Not a member yet? Register   Sign In
Unit testing best practices
#1

I am aware of: https://www.codeigniter.com/userguide3/libraries/unit_testing.html
However, my question is what are the best practices in CI for unit testing?



Should I have test methods in my controllers and models?
Or
Should I extend every controller and model and do the tests there?


Should I use the default unit testing class
Or
Should I use an outside tester?


Can I run tests in CLI
Or
Only in browser?


What is the preferred way to test for exceptions?

For example, I have a method that if you don't supply with a valid parameters, will throw a BadRequestException
How can I say: valid parameters, did not through exception
Invalid parameters: threw BadRequestException



Thanks!
Reply
#2

I recommend my ci-phpunit-test.
See http://kenjis.github.io/ci-phpunit-test/
Reply




Theme © iAndrew 2016 - Forum software by © MyBB