mtf

Running MTF

1. Make sure your Magento code is up to date.
2. Change to the dev/tests/functional directory, and run composer update to update any
dependencies that might prevent tests from running successfully.
composer update
3. Start Selenium. Selenium was downloaded by Composer, and can be found in the following
directory:
dev/tests/functional/vendor/netwing/selenium-server-standalone
Example
java -jar vendor/netwing/selenium-server-standalone/selenium-serverstandalone-2.39.0.jar
4. Start your tests using PHPUnit, using your integrated development environment (IDE), or
from the command line.
Example
cd dev/tests/functional
phpunit

Frequently Asked Questions

Q:

We want to run tests on a custom website. The tests assume that the main
website is called “Main Website,” and do not work. Is there a way to provide
a custom name without changing the tests?

A:

This is an error in the tests. Instead of “Main Website,” it should be set to main_website,
which will select the default website. The website_selection_patch will be included in next MTF
release.


Q:

I get errors in Mage\Adminhtml\Test\TestCase\CreateWebsiteEntityTest. How
can I fix it?

A:

This is an misconfiguration in the test, which was designed for an internal workflow. The website
patch addresses this issue.
You might also try this as an alternate solution. In the following file:
dev\tests\functional\tests\app\Mage\Adminhtml\Test\Constraint\
AssertProductIsPresentOnCustomWebsite.php
Change line 115 to:
$this->magentoRoot = realpath(MTF_BP . ‘/../../../’);


Q:

I get errors in Mage\Adminhtml\Test\TestCase\CreateStoreEntityTest. How
can I fix it?

A:

This test fails due to lack of translations. Install translations into Magento.


Q:

I get errors while testing a custom website.

A:

One possible reason is that translations enabled. The tests expect to find English text on the
page. Change the default language to English on the website that is being tested.


Q:

Why are some of tests so slow, especially when comparing the default address with the
data sets?

A:

This is caused by the way the Selenium server processes the SELECT statement. The next
version should address this issue.


Q:

Some of the tests are very slow, especially when choosing a category for a newly added
product. This process slows down when there are a lot of categories.

A:

This is caused by the algorithm that prepares the tree:
\Magento\Mtf\Client\Element\TreeElement
The next version should address this issue.


Q:

How can I create tests that extend an existing module? For example, how do we add
new attributes and assertions to customer tests?

A:

See this customer attribute example and instructions.


Q:

How can I create tests for a responsive theme or for any other custom theme?

A:

See this custom theme example and instructions.

Leave a Comment

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