I have been having some problems with a Magento site recently and am looking for a way to check the integrity of a Magento site at any given point.
Unit Testing jumps out as one method of doing this but I would assume it would be a very big job to write a whole lot of tests to check everything in the site is working as it should.
Can anyone involved in unit testing and magento advise on the following:
- Is it possible to test the whole site and not just custom modules –
is so some examples of tests would be amazing.
- Given that the site is heavily linked to the database – how would it
be possible to fully test the site without disturbing the database
- Are there any better ways to automaticlly check the integrity of a
When I say integrity i really mean that there are no faults on the site – shipping, payment etc are all working correctly.
This is a big task, however there are Magento community members who have tackled it.
The EcomDev_PHPUnit module provides a framework for unit testing Magento, but it doesn’t contain any actual tests. It could (and has) been used to test core functionality or modules that you have developed yourself.
One of the key advantages of the EcomDev module is that it does provide 100% isolation of your database. It creates an exact copy of your database structure, and then uses fixtures (see pg 6 of the manual) to insert data into those tables to create test pre-requisites. This is powerful and best practice, but does require quite a bit of setup.
You can try using phpMyAdmin to export data into YAML in readiness for creating fixtures.
There have been early conversations about creating a repository of unit tests to cover the core functionality, however keep in mind that Magento 2.0 (planned for 2012) advertises complete test coverage.