Magento 1 Testing Frameworks
-
16-10-2019 - |
سؤال
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?
المحلول
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.
نصائح أخرى
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
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/