What is Magento MFTF?
Short answer MFTF, the Magento Functional Testing Framework, describes end-to-end acceptance tests using XML and reusable Magento test assets. It generates PHP Codeception tests and uses browser automation to exercise an application. Its results cover the selected tests and environment, not every possible integration or production outcome.
- A test describes an observable user outcome 01
- Reusable assets describe data and interface targets 02
- The framework merges and generates executable tests 03
- The runner uses a prepared test environment 04
- Failures become evidence for investigation 05
Watch for this Using fixed sleeps instead of the right condition
From a test outcome to generated acceptance checks
Definitions, data, generation, execution and failure evidence each need deliberate ownership.
-
01
A test describes an observable user outcome
An MFTF test might create a product, open its storefront page and verify an expected interaction. Define the outcome and required data first. A sequence of clicks without a useful assertion does not establish that the workflow works.
-
02
Reusable assets describe data and interface targets
Tests can reference data entities, pages, sections and action groups. These reduce repeated setup and selectors when they are maintained as real contracts. An extension or theme change can still require those references and expectations to be updated.
-
03
The framework merges and generates executable tests
MFTF reads its XML declarations and module contributions and generates PHP Codeception tests. Keep the source declarations under version control. Editing generated tests alone leaves a change that regeneration can discard.
-
04
The runner uses a prepared test environment
Browser automation, framework/PHP compatibility, application configuration and test integrations must agree. Tests can use browser actions, API setup and application commands. Run state-changing suites against an isolated representative environment with synthetic data.
-
05
Failures become evidence for investigation
Use the failing assertion, logs and relevant artifacts to distinguish product defects from setup or synchronization problems. Screenshots and test output may contain sensitive data. Keep artifacts controlled and remove secrets from anything shared for review.
Where Magento-specific acceptance tests help
Select meaningful journeys and maintain the assets they depend on. Do not equate a framework name with complete coverage.
-
An extension changes an existing Magento workflow
Reuse or adapt appropriate framework assets to verify the change through a user-facing path. Confirm that the expected result reflects the extension's intended behavior rather than simply making the test green.
-
An upgrade needs focused regression coverage
Choose important journeys and edge cases affected by the change. An entire suite passing does not prove every integration, permission or payment behavior; state which risks the selected tests actually cover.
-
An Admin workflow needs repeatable acceptance
A product-management or order-processing journey can provide useful end-to-end coverage. Prepare the relevant permissions and data, and include cleanup so tests do not depend on a previous run's leftovers.
-
A team maintains Magento-specific test assets
MFTF can fit a team that benefits from module-aware XML assets and existing Commerce tests. Keep the framework and browser-driver setup compatible with the tested release rather than copying an old setup recipe unchanged.
Three causes of unreliable acceptance evidence
Test data, synchronization and assertions determine whether a failure is useful and reproducible.
-
Using fixed sleeps instead of the right condition
Wait for the state needed by the next action or assertion. Investigate slow requests, failed selectors and asynchronous updates. A longer pause can conceal a defect while making the suite slower and less reliable.
-
Sharing mutable data between unrelated tests
Tests that depend on order, reuse conflicting identifiers or leave configuration behind can fail inconsistently. Give setup and cleanup clear ownership, and avoid parallel runs that compete for the same mutable fixture.
-
Treating generated output or screenshots as complete proof
Keep test definitions, selected scope and failure context with the result. A screenshot alone may not show the required business outcome. Protect artifacts and diagnose failures before changing assertions to match an unintended behavior.
Magento MFTF: frequently asked questions
-
MFTF vs PHPUnit: what is the difference?
PHPUnit commonly verifies PHP units or integration behavior at a lower level. MFTF verifies functional application journeys using generated Codeception/browser tests. They answer different questions and can complement each other; a browser check does not replace focused server-side authorization or business-rule tests. -
MFTF vs Cypress or Playwright: why not those?
Choose tools against the workflow and maintained test assets. MFTF integrates Magento-specific XML, module merging and reusable action/data definitions. Other browser frameworks can test user journeys too, but they do not automatically consume the same assets. Marketplace requirements must be checked separately rather than inferred from the framework name. -
Can I write MFTF tests in PHP?
The authored functional tests use the documented XML format; MFTF generates PHP Codeception tests from it. Framework extensions or supported helpers may involve PHP, but hand-editing generated output is not a durable test-authoring workflow. Keep custom source in owned test code. -
Does MFTF work on Hyvä storefronts?
The browser can interact with a Hyvä storefront, but existing Luma selectors and assumptions do not automatically match it. Adapt page/section targets, data and assertions to the actual theme and checkout. Validate the chosen framework and driver versions without claiming universal compatibility. -
How long does an MFTF suite take to run?
Time depends on the selected tests, setup, data operations, browser execution and environment. Measure the intended suite and report its scope and conditions. There is no reliable fixed minutes-per-test or guaranteed speed-up from parallelism when tests share mutable data. -
Can MFTF run against production?
Normal acceptance suites should run in a dedicated test environment. They can create or change customers, products, orders and configuration, and may trigger integrations. Use synthetic data and isolated external services. A production monitoring check requires its own explicitly bounded design; it is not permission to point an ordinary MFTF suite at live data.
Planning functional test coverage?
Describe the changed workflows, representative test environment and required assertions. Use synthetic data and controlled integrations when defining the acceptance scope.