Screencast about testing controllers with CakePHP

Published on and tagged with cakephp  controller  screencast  testing

Yesterday I stumbled upon a screencast by Fernando Baraja (aka FernyB), in which he gives an introduction about testing controllers with CakePHP (you can skip the first few minutes because they are about installing CakePHP). This screencast seems to be the start of a series of CakePHP screencasts.

You can find additional information about testing controllers in the cookbook.

Happy testing :)

6 comments baked

  • Ahsan

    Thanks for sharing :)

  • Abhimanyu Grover

    Thanks, let me have a look. BTW, one question, what in your opinion is better for unit testing? CakeWebTestCase or CakeTestCase?

  • cakebaker

    @Ahsan, Abhimanyu: Thanks for your comments!

    @Abhimanyu: CakeTestCase is better suited for unit testing. CakeWebTestCase is more for testing on a higher level. It simulates a browser and allows you to test entire workflows like creating a new user.

    Hope that answers your question!

  • Jonah

    The screencast was very badly done in my opinion. Hard to tell what he was doing and he didn’t explain everything and when he did he did not explain it properly. He kind of mumbled, and didn’t say much.

    I hope he keeps up the work anyways, but I won’t be watching.

  • Abhimanyu Grover

    @cakebaker

    I know that, but which one is better in smaller projects? So far I’m good at web test case, it does have some limitations and so have normal test case.

  • cakebaker

    @Jonah: Yes, that’s true, the intention of what he is doing is not always visible right away.

    @Abhimanyu: Hm, difficult to say, it depends on what “better” means to you. In principal you need both kinds of tests if you want to test thoroughly. The normal test cases to ensure your classes work correctly, and web test cases to ensure the interaction of the classes works as expected.

Bake a comment




(for code please use <code>...</code> [no escaping necessary])

© daniel hofstetter. Licensed under a Creative Commons License