Testing API's written in PHP using the Behat feature testing tool
summary
Shows using Behat with the Mink extension and Symfony integration to write API end‑to‑end tests in Gherkin that call endpoints, assert JSON (use strict JSON Schema: required + additionalProperties false) and verify database effects by truncating tables via Doctrine before scenarios. Examples include delete‑task scenarios (owner vs other user), CI tag skipping for flaky third‑party calls, stop‑on‑failure workflow, and a tiny Symfony users+tasks demo on GitHub. Team reports bugs drop to almost negligible after adopting this setup.
AI-written summary · about
chapters (20)
- 0:00Behat and API testing intro
- 1:54What is Behat
- 3:20Installing Behat
- 5:04Configuring Behat
- 5:25Gherkin syntax
- 7:13API tests with Gherkin
- 8:15Behat contexts
- 10:23Open-source Behat contexts
- 12:12Tagging tests
- 13:21Hooks for setup
- 15:49Backgrounds in tests
- 16:32Testing with outlines
- 18:20Running Behat CLI
- 19:24Formatting test output
- 19:46Validating JSON schemas
- 20:28HTTPS cert handling
- 21:09Behat for teamwork
- 22:34API testing benefits
- 24:00Behat in PHPStorm
- 25:27Conclusion
related talks
34mTesting APIs written in PHP using the Behat feature testing tool
27mAutomated Web Acceptance Testing with Behat
45mBehat for characterisation on tests
45mBehat from 0 to Hero: a Practical Guide
45mBehaviour Driven Development and Behat: Telling Stories Through Code
26mBehaviour Driven Development with Laravel
49mTesting for the Brave and True
30mPHP: BDD revolution — how we returned from hell
