I want to use the Magento Test Automation Framework to create a Smoke Test Suite, i.e. a test suite that quickly tests a cross section of the store to check for serious errors, not to test the correct behaviour of all features.

The included test suite does not serve this purpose well, it tests the shop very thoroughly and creates test data for each test by foot in the backend (which takes way too much time).

Writing custom tests for my test suite is not a problem, but I also would like to optimize the creation of test data.

My tests will run on the same machine as the SUT, so it seems natural to create a test fixture directly in the database instead of using Selenium. Now my question is: Is there a clean way to integrate the fixture system of EcomDev_PHPUnit into TAF?

The problem is that the fixture is coupled to EcomDev_PHPUnit_Test_Case and the TAF tests have to extend Mage_Selenium_TestCase. I would like to use EcomDev_PHPUnit_Model_Fixture as a standalone component, is that possible? Or are there better ways to create database fixtures for a TAF test suite?


2 Answers 2


The fixture magic happens in the listener method \EcomDev_PHPUnit_Test_Listener::startTest():

public function startTest(PHPUnit_Framework_Test $test)
    // [...]
    $annotations = $test->getAnnotations();

So you could pretty much execute this code (passing your test class) manually before each test. It already read the @loadFixture annotation of your test method.

To have everything working automatically as you are used to from EcomDev_PHPUnit you need to the necessary files from EcomDev_PHPUnit installed (installing the full package should be fine) and you have to add the entry

    <listener file="app/code/community/EcomDev/PHPUnit/Test/Listener.php" class="EcomDev_PHPUnit_Test_Listener" />    

In your phpunit.xml. This should not conflict with TAF in any way, as it is not necessary at any point to extent from EcomDev_PHPUnit_Test_Case. Especially note, that the above listener requires an instance of PHPUnit_Framework_Test only.

PS: I am referring to the latest version on GitHub of EcomDev_PHPUnit as there were some changes in structure recently.

  • 1
    Thanks, this put me in the right direction! Additionally, Mage/App.php had to be included in the bootstrap.php and the same-db flag of EcomDev_PHPUnit set to 1 so that the fixture can operate on the "live" database. There are still some issues that I have to figure out but I managed to combine the fixture system with TAF with your help, so I'll accept the answer. Thanks again! Mar 4, 2013 at 14:12

You should think about MageBehat for this purpose:


Behat is based on Selenium and there are a few testcases already implemented, like checkout.

  • It's a promising project but it does not solve the fixture problem (yet), or am I missing something? Feb 22, 2013 at 14:51
  • No, you are right. I think it were better a comment :) Feb 22, 2013 at 17:06

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.