1

I've read the documentation that is available for the new MFTF for Magento 2, however I can't figure out how to go about creating tests that are located in a different folder other than the folders that correspond to the Magento core modules.

More specifically, right now, if I want to create a new test for myself, the only solution that I managed to come up with is to go to <magento2root>/dev/tests/acceptance/functional/Magento/FunctionalTest/ and add the various .xml files in one of the folders inside. Then I can run vendor/bin/robo generate:tests, it will generate the new tests, and I'll be able to run the tests.

My question is: How can I add those .xml files in some other folder, like <magento2root>/dev/tests/acceptance/functional/CustomCompany/FunctionalTest/CustomModule, and be able to generate the tests,so I don't have to mix up my custom code with the core Magento code? Does it have something to do with the .env file?

0

When MFTF goes to generate the Tests it checks with the Magento store to see which Modules are enabled and only consumes the Test directories for those Modules. Luckily you can enabled Custom Modules and Custom Directories that you'd like to be consume during the robo generate:tests step.

Please open your .env file and modify the MODULE_WHITELIST or CUSTOM_MODULE_PATHS attributes.

  • MODULE_WHITELIST - IF you have a new Module that is not "installed" yet in your Magento instance please list the new Module here. Make sure you start it with "Magento_" followed by the Module Name:
    • ex. MODULE_WHITELIST=Magento_CustomModule
  • CUSTOM_MODULE_PATHS - IF you have a folder of Test data that is not listed in a Module you can point to that Test directory by adding the FULL PATH to the directory of Test data:
    • ex. CUSTOM_MODULE_PATHS=/Users/FIRST_LAST/Desktop/ModuleName/Test/Acceptance

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

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