Category Archives: testing

YAML in a cake? No, thank you!

While implementing fixture support in the testsuite the question arised which format should be used for the fixtures? The first answer was: YAML, of course. It is used in Ruby on Rails, so it cannot be bad ;-) Hm. Let’s have a look at a simple YAML example: // urls.yml cakephp: id: 1 name: CakePHP […]

Testing a cake – what’s missing?

In the last few days I discussed with several people about (unit) testing in CakePHP. The result is that testing with CakePHP is not as easy as it should be (not really a surprise if you ever tried to write tests *g*), and that some features are missing. So here my current todo list for […]

Overcoming the limitations of Selenium Core

While working with Selenium Core I encountered a limitation as I tried to do a payment with PayPal: it is not possible to visit another domain from within your tests. The reason is the “Same Origin Policy” which applies to Selenium Core according to “Which Selenium Tool Should I Use?”: Selenium Core needs to be […]

New versions of the Selenium helper

There are two new versions of the Selenium helper available. Version 0.2 is a bug fix release. It was created by Felix Geisendörfer, and fixes a XPath problem with Internet Explorer. Thanks Felix! Version 0.3 supports the new release of Selenium (version 0.7.0). A lot of new functions have been added (such functions are marked […]

Upgrading to version 1.0

Today, I updated to version 1.0 (1.0.1.2708 according to version.txt) of CakePHP (yeah, I know, I am lame, but due to problems with Eclipse I was not able to keep up with the trunk in the last days). But nonetheless, I was surprised to see a lot of my tests fail after the update: 6 […]

Testing infrastructure has been moved to CakeForge

Since the restructuring of the trunk, the testing infrastructure for CakePHP has been moved to its own project on CakeForge. There is no release available yet, so you have to retrieve the files directly from the Subversion repository, see http://cakeforge.org/scm/?group_id=62 for instructions. Oh, by the way, there are two additional new projects on CakeForge: truPaste, […]

File upload with Selenium

In my Selenium tests I want to upload some files. Due to security restrictions it is by default not possible that a Javascript fills in a path in the respective input field. But fortunately, there exists a workaround: a) The Mozilla must have the configuration option “signed.applets.codebase_principal_support” set to the value “true”. This allows non-signed […]

Selenium

In the last days I experimented with Selenium (thanks to knoebi for the hint). What is Selenium? Here the description from the website: Selenium is a test tool for web applications. Selenium tests run directly in a browser, just as real users do. I have to admit that I like Selenium, and so I will […]

Test your models

I am a fan of test driven development (TDD) and so it is my goal to use this approach with CakePHP. In this post I will show you how to unit test a model. See http://wiki.cakephp.org/tutorials:testing_cake_apps for the configuration of the testing infrastructure. Let us write a model for a contact form, where the user […]

Switch your database configuration based on some criteria

Currently, I am experimenting with unit tests. These tests should use an own database. And so I defined a “test” configuration in app/config/database.php: var $test = array(‘driver’ => ‘mysql’, ‘connect’ => ‘mysql_pconnect’, ‘host’ => ‘localhost’, ‘login’ => ‘user’, ‘password’ => ‘password’, ‘database’ => ‘project_name-test’, ‘prefix’ => ”); But it does not automatically use the “test” […]

Follow

Get every new post delivered to your Inbox.