Topic: Magento 2

Magento 2 Functional Testings (MTAF) 0

Magetno 2 comes with built in functional test framework.(MTAF) This is also available for Magento 1 too. Here is the quick step by step guide to how to run these functional test cases.


  • Working Magento 2 installation
  • Disable admin security key urls from magento admin panel. Store=>Config=>Advanced=>Admin=>Add security key url=NoSelection_003
  • Firefox or Google chrome web browser
  • Java runtime installed in your machine
  • PHP Composer

How to Run

  • Got to <magento root>/dev/tests/functional/.
  • Run composer install to install required dependancies. This will download mtaf, selinium RC etc to vendor folder. [composer install]
  • Run [php utils/generate/factory.php] after composer install to generate required factories.
  • Open phpunit.xml and update urls


<env name="app_frontend_url" value="" />

<env name="app_backend_url" value="" />

<env name="testsuite_rule" value="basic" />

<env name="testsuite_rule_path" value="Magento/Mtf/TestSuite/InjectableTests" />

<env name="log_directory" value="var/log" />

<env name="events_preset" value="base" />

<env name="module_whitelist" value="Magento_Install" />

<env name="basedir" value="var/log" />

<env name="credentials_file_path" value="./credentials.xml.dist" />

  • Open etc/config.xml and update login credentials

<config xmlns:xsi="" xsi:noNamespaceSchemaLocation="config.xsd">
















  • Those are the minimum configuration to get test cases runinng. You can find more descriptive configuration documents under vendor/magento/mtf/docs/
  • Start Selenium by [java -jar vendor/netwing/selenium-server-standalone/selenium-server-standalone-2.44.0.jar] your version may variy
  • Now run phpunit from <magento root>/dev/tests/functional/

Following are all the commands that used.

cd <magento root>/dev/tests/functional

composer install

vi phpunit.xml (change urls)

vi etc/config.xml (change urls/credentials)

java -jar vendor/netwing/selenium-server-standalone/selenium-server-standalone-2.44.0.jar


Please upgrade your database: Run “bin/magento setup:upgrade” from the Magento root directory. 0


When you try to run Magento 2 and if you get above error,

copy this code

bin/magento setup:upgrade

Go to your Magento 2 root folder.

Open the Git Bash ( I think this will work on command prompt as well )
Paste the code and Enter.


It will execute and once it completed, Run Magento 2.

SQLSTATE[HY000] [1045] Access denied for user ‘root’@’localhost’ (using password: YES) 0


When you try to run Magento 2 and If you get this error message, possible reason is wrong username or password.

You can change this by editing, below information.

Go to app folder > Etc > and open env.php

In this file, you can find below code section

array (
'host' => 'localhost',
'dbname' => 'magento2',
'username' => 'root',
'password' => '',
'model' => 'mysql4',
'engine' => 'innodb',
'initStatements' => 'SET NAMES utf8;',
'active' => '1',

Replace your database information.

How to Change database details in Magento 2 0

You can do this easily 🙂

Go to app folder > Etc > and open env.php

In this file, you can find below code section

array (
'host' => 'localhost',
'dbname' => 'magento2',
'username' => 'root',
'password' => '',
'model' => 'mysql4',
'engine' => 'innodb',
'initStatements' => 'SET NAMES utf8;',
'active' => '1',

Edit the details and add your database information.

That’s it 🙂

Introduction to Magento 2 0

Magento 2 is going to be released in early 2016 with new architectural and functional improvements. You can try community edition freely from git hub. (git link) Followings are some new features available in community edition.

  • Bootstrap for autoloading.
  • Dependancy Injection for object loading.(DI) Factory methods are no longer exists.
  • Zend 2.
  • New module structure. All blocks / layouts / templates are in same folder.
  • Core was completely removed. Adminhtml was replaced by backend.
  • core_resource table was replaced by setup_module.
  • Unlimited theme fallback. Introduced in CE 1.6 upward. theme.xml under design theme etc folder.
  • Full page cache.
  • Built in varnish cache.
  • Less for css.
  • Built in less compiler.
  • Layout files can be extended instead of copying all contents.
  • Composer for php dependancy management.

It gives significant performance improvements with all these features. And there are more customization options are available with minimum conflicts. Plugins and Preferances are major customization options they added. Plugins allow us to intercept method call and Preferances allow to change run time class in DI. Also it gives more flexible customizations with DI by changing constructor params via di.xml. Indexed php is no longer exsists, it uses bin/magento to achive all shell functions like indexing, log cleaning etc. Also there some new functions available through magento. Follwing diagram shows general process flow of Magento2.