Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Integration Testing in CakePHP 2.0

I'm a rails developer, and I want to do some capybara+(rspec or cucumber) style of integration testing with cakephp 2.0. I was using PHPUnit (the default test framework for cake 2.0) but I don't know how to integrate it with Selenium and Cake at the same time to get the full stack effect that you have on rails

So, for the experience php devs that have used cake 2.0... how do you guys do a proper integration testing?

like image 274
fespinozacast Avatar asked May 03 '12 21:05

fespinozacast


Video Answer


1 Answers

I'm not surprised there's been no answer on this - the community of testers within CakePHP seems to be extremely small. I've worked on large projects with huge numbers of functional and unit tests (currently a suite of around 1500 tests), but to do that I needed to extend the CakePHP test suite functionality (you can take a look at my now slightly outdated TDD plugin).

When we started we didn't know a whole lot about integration testing, and setting up a decent unit testing environment was enough of a challenge. We now use Rails :)

Basically, this is not a well-worn path. To get something working will require an extension to the framework - it will also require a new test case class, which extends PHPUnit_Extensions_Selenium2TestCase, and integrates any necessary functionality from CakeTestCase and ControllerTestCase.

I hope you get somewhere! If you do, it would be great if you could share the code with the rest of the community.

like image 52
Jon Cairns Avatar answered Sep 30 '22 11:09

Jon Cairns