To quickly debug Magento 2 MFTF tests, go to PHPStorm configuration and add new Codeception configuration:
- Meaningful name
- Test scope:
file
- File:
<document_root>/dev/tests/acceptance/tests/functional/Magento/_generated/default/<your_mftf_TestCest.php>
- Use alternative configuration file:
<document_root>/dev/tests/acceptance/codeception.yml
Now you can run debug configuration by entering ^D
or Debug
button.
By the way, it’s better to Stop Listening for PHP Debug Connections
because debug works faster in this way.
When you update your MFTF xml file, you need to regenerate your MFTF test by running vendor/bin/mftf generate:tests YourTestName
for your *TestCest.php file to be regenerated. Now you can debug your updated MFTF test further.
Your should also have Codeception test framework config setup for your current project. To have it:
- Go to PHPStorm settings -> Languages & Frameworks -> PHP -> Test Frameworks.
- Add Codeception configuration type.
- Add path to Codeception executable: <document_root>/vendor/codeception/codeception/codecep
Some helpful MFTF commands:
vendor/bin/mftf doctor
– general MFTF health checkallure generate tests/_output/allure-results
in <document_root>/dev/tests/acceptance folder – generate allure report locallyallure open allure-report
inĀ <document_root>/dev/tests/acceptance folder – open allure report locally