Magento - Unit Testing

I recently had problems with the Magento website and am looking for a way to check the integrity of the Magento website at any time.

Unit Testing jumps out as one way to do this, but I would suggest that it would be a lot of work to write a lot of tests to verify that everything on the site is working as it should.

Can anyone involved in unit testing and magento recommend the following:

  • Is it possible to test the entire site, and not just user modules - so some of the test examples will be amazing.
  • Given that the site is heavily connected to the database - how it will be able to fully test the site without disrupting the database.
  • Are there more efficient ways to automatically check the integrity of a magento site

When I say honesty, I really mean that there are no failures on the site - delivery, payment, etc. all work correctly.

+7
source share
1 answer

This is a big task, but there are members of the Magento community who have taken it.

The EcomDev_PHPUnit module provides the basis for Magento unit testing, but it does not contain any real tests. It could (and was) be used to test basic functionality or modules that you yourself developed.

One of the key benefits of the EcomDev module is that it provides 100% database isolation. It creates an exact copy of the structure of your database, and then uses devices (see page 6 of the manual ) to insert data into these tables to create test prerequisites. This is a powerful and best practice, but requires quite a bit of customization.

You can try using phpMyAdmin to export data to YAML in readiness to create fixtures.

An alternative is to create and automate a comprehensive Selenium test suite for the browser user interface. In fact, the best solution is to prepare tests for the unit and UI, as there will be areas that can only be tested in one functional domain. There is a lot of business logic built into Magento Javascript (e.g. all validation.js) that PHPUnit cannot easily test, Selenium is your best option here.

early talk of creating a unit test repository to cover core features, however keep in mind that Magento 2.0 (planned for 2012) advertises full testing coverage .

+15
source

All Articles