dsdvr06648 2011-09-10 23:27
浏览 44

Magento - 单元测试

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:

  1. Is it possible to test the whole site and not just custom modules - is so some examples of tests would be amazing.
  2. Given that the site is heavily linked to the database - how would it be possible to fully test the site without disturbing the database
  3. Are there any better ways to automaticlly check the integrity of a magento site

When I say integrity i really mean that there are no faults on the site - shipping, payment etc are all working correctly.

  • 写回答

1条回答 默认 最新

  • dswfyq6201 2011-09-11 08:20
    关注

    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.

    The alternative is to create and automate a comprehensive Selenium test suite for the browser UI. In fact, the best solution is to prepare both unit and UI tests as there will be areas that can only be tested in one functional domain. There is a significant amount of business logic built into Magento's Javascript (all the validation.js for example) that PHPUnit can't easily test, Selenium is your best option here.

    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.

    评论

报告相同问题?

悬赏问题

  • ¥15 谁有desed数据集呀
  • ¥20 手写数字识别运行c仿真时,程序报错错误代码sim211-100
  • ¥15 关于#hadoop#的问题
  • ¥15 (标签-Python|关键词-socket)
  • ¥15 keil里为什么main.c定义的函数在it.c调用不了
  • ¥50 切换TabTip键盘的输入法
  • ¥15 可否在不同线程中调用封装数据库操作的类
  • ¥15 微带串馈天线阵列每个阵元宽度计算
  • ¥15 keil的map文件中Image component sizes各项意思
  • ¥20 求个正点原子stm32f407开发版的贪吃蛇游戏