Slow test suite, ramdisk and Mac OSX

As I’m working with Symfony2, in some projects I found useful a boost in perfomance while runnig tests.

One of the way of speeding up your tests is to put the symfony cache and logs directories into a ram disk. Even better would be to put in there also the database (if you’re using SQLite). To create a ramdisk on OSX, we use a script written by  Francesco Tassi.

The only thing left is to congifure yout Symfony2 project:

    # app/config/config_test.yml or parameter_test.ini
    kernel.cache_dir = /Volumes/ramdisk/symfony/cache
    kernel.logs_dir = /Volumes/ramdisk/symfony/logs

and you’re good to go!

Another way of improving your test suite is described into the LiipFunctionaTestBundle documentation (if you’re using their bundle 😉 ). This bundle gives you the ability of sharing a cached SQLite database between tests that are using the same set of fixtures.

And last but not least, a Kris Wallsmith’s blog post where he describes how to avoid creating a new kernel for each new “client” in your functional test. This solution seems to work pretty well but the only thing I couldn’t find a way to do was to test emails  through the profiler.

Happy testing! 😉