magento-test

Magento Test Framework

The Magento Test Framework (MTF) is a tool that can run nearly 170 automated functional
tests, which are included in Magento and designed to improve the quality of implementations
and to make it easier to perform basic acceptance testing when adding extensions, making
customizations, or upgrading Mag

Installation

1. Download Composer for UNIX or Windows. Then, follow the instructions to install Composer.
2. Run Composer from the [Magento install]/dev/tests/functional directory as
follows:
composer install
If you cannot run composer from the command line, do the following:
a. Copy composer.phar to the same directory where composer.json is located. The
typical location is:
[Magento install dir]/dev/tests/functional
The composer.json file contains dependency information and settings for PHPUnit,
Selenium server, libraries, and so on, and is required to start MTF. It checks out MTF from a
separate repository.
b. Run Composer as follows:
php composer.phar install
A new directory named vendor is created with the checked-out MTF. The vendor directory
contains:

  • An MTF framework directory ( magento/mtf )
  • bin
  • composer
  • netwing
  • phpunit
  • symfony
  • autoload.php (file)

3. To run the generator, do one of the following:

  • Use your browser to navigate to the following location:
    [Magento install dir]/dev/tests/functional/utils/generate.php
  • Execute the following from the command line:
    php utils/generate/factory.php

The generator tool creates generated directories with factories for pages, blocks, handlers,
fixtures and repositories. After MTF is initialized, the factories are pre-generated to facilitate
creating and running tests.

Configuration

Non-Firefox Browsers>/h4>
If using a browser other than Firefox, you must first download drivers that are compatible with
Selenium. Then, add the following declaration to the config.xml file. The file is is located at:
[Magento install]/dev/tests/functional/etc/config.xml


ANY


To learn more, see the Selenium Documentation.

Magento URLs

Update the phpunit.xml file with the URLs of your storefront and Magento Admin as
follows:

Configuration Reference

This reference provides information about each MTF configuration section located at:
[Magento install dir]/dev/tests/functional/etc/config.xml

application

Provides the login credentials for the Magento Admin.
Sample

testCase
admin
123123q
admin/auth/login

isolation

Sample
Specifies the isolation strategies for tests, cases, and suites.

dev/tests/mtf/isolation.php
before
none
none

Your isolation strategy determines when the system returns to its initial state. An isolation
strategy can apply to any scope, such as a test, case, or suite. The following four isolation
strategies are available:

server

Specifies the Selenium web browser (if not Firefox) and other options. For a list of valid
browserName values, see:

  • Selenium source code
  • List of Selenium RC Browser Launchers

Sample


ANY

Leave a Comment

Your email address will not be published. Required fields are marked *