Skip to content
Lee Bolding edited this page Jun 8, 2013 · 14 revisions

Mage_Test

A community owned and driven unit and integration test framework for Magento

Documentation & Support

Goals

  1. Provide a continuously evolving and improving means to provide confidence in the overall health of a Magento or Mage+ instance, that can be retrofitted at any time to aid troubleshooting
  2. Provide an easy to use, non-intrusive unit test framework compatible with both Magento and Mage+
  3. Provide an easy to use, non-intrusive integration test framework compatible with both Magento and Mage+
  4. Provide an easy to use, non-intrusive and backward compatible method allowing 3rd party and commercial extension developers to include unit and integration tests in their own extensions
  5. Provide a suite of unit tests covering Magento and Mage+ core modules, allowing users of either to verify functionality of their Magento instance upon installation
  6. Provide a suite of integration tests covering Magento and Mage+ core modules, allowing developers to verify that their modifications have not broken any core Magento or Mage+ functionality
  7. Provide all of the above inside of an extension that fits inside the core "Mage_" namespace, thus appearing to be core Magento functionality

Quick Start

Mage_Test is designed to be installed and updated via modman.

First, make sure that you have both modman and PHPUnit installed (follow their respective installation procedures if you do not)

If you haven't already done so, change directory to your Magento document root, and initialise modman

$> cd /path/to/your/magento/install

$> modman init

Next, install Mage_Test via modman :

$> modman clone git://github.com/mageplus/Mage_Test.git

Next, you need to create a new, empty database for Mage_Test to use where database operations occur. The usual convention is to name this the same as your production database with the suffix of "_tests" (eg, if your production database is named "magento", your tests database should be named "magento_tests")

Finally, make a copy of local.xml.phpunit.template file (that now appears in app/etc), naming it local.xml.phpunit. Mage_Test uses this file for it's configuration. Edit app/etc/local.xml.phpunit so that it has the relevant details for the test environment - this is the same format as local.xml, but specifically for the test environment

Unless you want to run each test in it's own process (which is MUCH slower), it's you should also increase the PHP memory_limit size in your php.ini (2048M ought to do it)

You can now run Mage_Test :

$> phpunit UnitTests.php

Now that you've seen some tests running (and doubtlessly also some failing), you should probably head over to our Getting Started Guide to learn about what to do next

Updating

Upgrading Mage_Test is simple, quick, and easy :

$> cd /path/to/your/magento/install

$> modman update Mage_Test

Next Steps

The best place to get documentation is at https://github.com/mageplus/Mage_Test/wiki/documentation

If you have any questions, please email the mailing list at http://groups.google.com/group/magetest-users

Bugs Reports & Contributing

Feature Requests

Feature requests can be made by submitting an issue - feature requests will be labelled with the label "enhancement" and initially as "unconfirmed". At this point the feature request will be reviewed and assigned to a (release) milestone - this is the release in which you can expect to see your feature. The issue relating to this feature will change status to "confirmed" as soon as work begins on it.

If you are a developer, you can also submit a pull request containing the feature you wish to contribute.

If you are going to submit a pull request, please read the contributing guide: https://github.com/mageplus/Mage_Test/wiki/Contributing

Copyright

Copyright (c) 2012, 2013 Mage+ Ltd. See LICENSE.txt for details.