Reading list Switch to dark mode

    Prerequisite for Custom Modules with Magento Functional Testing Framework

    Updated 24 October 2018

    MFTF helps you to minimize your repetitive tasks. It’s easy to learn and write MFTF test cases. The test cases we write in MFTF are all in xml. And it automatically converts all your written test cases in codeception format.

    Here I’ll explain to you what the basic things you need to do to use your MFTF tests for your custom module. If you have not written any of the tests yet. Don’t need to worry. Please check my blog on MFTF (Magento 2 Functional Testing Framework) for Custom Signup Form to learn how to write tests for custom modules.

    For testing please set up all the required things as explained here. To learn the basics of MFTF you can read Magento Functional Testing Framework Guide.

    You can write your test inside YourMagentoRoot/dev/tests/acceptance/tests/functional/Magento/FunctionalTest/YourModuleName.
    Inside this you need to create ActionGroup, Data, Page, Section, Test depending on your module requirements.

    To generate the tests you need to run the command – vendor/bin/robo generate:tests. It checks for the all enabled modules in your Magento and generate tests for those modules only. So, to generate the tests for your custom module you need to do some chages in .env file.

    Searching for an experienced
    Magento 2 Company ?
    Read More

    Before writing tests for your custom module you need to go inside YourMagentoRoot/dev/tests/acceptance/ and open .env file and need to remove comment from the line “MODULE_WHITELIST=” and add an entry for your module like-

    MODULE_WHITELIST=Magento_YourModuleName and save it.


    In case of any doubt please leave us a comment here. 🙂



    . . .
    Discuss on Helpdesk

    Leave a Comment

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


  • Parveen Narwal
    Hello, when we run the tests we are getting This error

    [Facebook\WebDriver\Exception\SessionNotCreatedException] Unable to create new service: ChromeDriverService
    Build info: version: ‘3.13.0’, revision: ‘2f0d292’, time: ‘2018-06-25T15:32:19.891Z’
    System info: host: ‘support-Vostro-260s’, ip: ‘’, ‘Linux’, os.arch: ‘amd64’, os.version: ‘4.4.0-141-generic’, java.version: ‘1.8.0_201’
    Driver info: driver.version: unknown
    How we resolve this error and run succesfully test.
    i install the cgrome driver also.
    Its a very urgent for me

    • Ayaz Mittaqi (Moderator)
      It seems the chrome driver is not getting figure out by the selenium standalone server. Put the selenium standalone server and the chrome driver at the same path and then again try to run the test case.
  • Jaya Venkat
    Do I need to have only one .Env file under dev/tests/acceptance? Where can I find existing functional test cases like forgot password, required field test…When I say /vendor/bin MFTF, which folder it refers for tests?
    • Jaya Venkat
      Sorry typo in above question. When I say /vendor/bin MFTF Run:tests AdminLoginTest, which folder it will refer for tests? I am seeing whole lot modules under /vendor/magento/Magento2-functional-test-framework/src/magento/
      • Ayaz Mittaqi (Moderator)
        The test cases are present in there respective module folders. For example you can find the test AdminLoginTest in vendor/magento/module-backend/Test/Mftf/Test/AdminLoginTest.xml When you run generate:tests command, the xml files are converted to Cest file which are present in dev/tests/acceptance/tests/functional/Magento/FunctionalTest/_generated/ directory. So, for the test case AdminLoginTest you can look for the file AdminLoginTestCest.php in _generated directory.
  • Back to Top

    Message Sent!

    If you have more details or questions, you can reply to the received confirmation email.

    Back to Home