Behat Best Practices
summary
Behat is used as a living-spec tool that runs Gherkin and maps Given/When/Then to PHP context methods, not as a browser automation toy; workflow recommends drive domain objects first, then refactor to a service layer tested via Behat contexts, and only add a few UI checks (Mink + Symfony/PSR‑7 drivers, Selenium or headless Chrome) to verify integration. Use fake infrastructure for speed and separate contract tests to guarantee parity with real storage, and run one end-to-end scenario via UI rather than exhaustively. Use fake infrastructure plus contract tests to keep suites fast and reliable.
AI-written summary · about
