16

Wherever I can, I like to develop software following a Test Driven Development (TDD) approach. Usually, in PHP that means using PHPUnit.

Ideally, I would like to write both fine and coarse-grained tests. Unittests to help guide the design and quality of my code, integration tests to make sure it all hangs together and high-level outside in acceptance tests to make sure I actually deliver what my customer has asked me to deliver.

Are there any test frameworks out there tailored for Magento which facilitate TDD?

17

We are using the EcomDev_PHPUnit extension which allows you to test almost everything in Magento without modifying any core files.

I recommend the dev branch which is currently more stable than the master.

We also have experience with Mage-Test, but can not recommend it, because it overwrites some core files in the community codePool.

| improve this answer | |
  • 2
    Yup, I can vouch for that one. We're using it, too. – nevvermind Jan 25 '13 at 8:34
  • 3
    EcomDev_PHPUnit I think is the most widely used. +1 on the dev branch. At the last Magento hackathon we put together github.com/magento-hackathon/MageBehat if you want to run browser based integration tests. – Kristof at Fooman Jan 25 '13 at 9:11
  • Thanks for the answer Tobias, any chance you could roll-up any other test frameworks you know of for Magento into your answer too? – Aaron Bonner Jan 25 '13 at 9:35
  • Totally. It's not very hard to bootstrap Magento into a test framework. I like to keep things simple and light, so I rarely use anything but plain PHPUnit with Magento 1. For me no extra Magento testing framework turned out to be simpler and easier. – Vinai Jun 16 '16 at 21:03
4

If you want something very simple and quick to setup, take a look at Testify

I used it in one of my projects to quickly test Model and Helper methods. For an example on how to run it with Magento, check: https://github.com/erfanimani/Ezimport/blob/master/tests/test.php

| improve this answer | |
  • 2
    That's great, it's like silex for testing! – Aaron Bonner Jan 25 '13 at 9:32
4

You could also look at extending the Magento Test Automation Framework which has over 1000 functional tests and which is used to check Magento Community Edition's nightly builds http://www.magentocommerce.com/blog/comments/automate-your-testing-with-the-magento-test-automation-framework/

| improve this answer | |

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.