Codeception Behaviour Driven (BDD)
Behat was the go-to BDD framework for PHP. Then PHP 7 came out and Behat only supported 5.4. That left a gap.
13 Oct 2023 · 2 min read

Behat was the go-to BDD framework for PHP. Then PHP 7 came out and Behat only supported 5.4. That left a gap.
Codeception filled it.
What it does
Codeception is a testing framework for PHP that handles unit tests, functional tests, and acceptance tests in one tool. It's PHPUnit with batteries included — Selenium support, data cleanup, fixtures, and readable test syntax all built in.
Why use it
Two questions from their own FAQ stuck with me:
"Do I really need this?" If you build web apps with forms, links, multiple pages, or APIs, and you want to verify all of it in minutes instead of hours — yes.
"Why not just PHPUnit?" PHPUnit is great for unit tests. But functional testing with Selenium, managing test data, writing XPath selectors — PHPUnit makes all of that painful. Codeception handles it out of the box.
The trade-off
Codeception gives you a single framework for all test levels. BDD-style tests read almost like English. Setup is fast.
The cost: it's opinionated. If your testing needs don't fit Codeception's patterns, you'll fight the framework. And it's PHP-only — if your stack is mixed, you'll need separate tools for non-PHP services.
It works well with frameworks like Laravel and Yii. For raw PHP projects, it's equally straightforward.
Ehsan Gazar helps software engineers take LLM and agent systems from demo to production. He writes about building LLM systems that hold up in production: evals, tracing, RAG, agent architecture and cost control. He teaches the Senior to Staff AI Engineer cohort on Maven, where engineers learn to design and defend these systems.
Forward Deployed AI Engineering: From Customer Problem to Production Value
A live Maven cohort for engineers: 10 live 90-minute sessions taking one AI engagement from customer problem to production, ending with eight artefacts and a working slice in your own repo.
January cohort starts Tue 12 Jan 2027, Tue & Thu 6:30pm London. Enrolling now, 20 seats, $1,800.
View the live cohortKeep reading
- TypeScript Anti-Patterns That Cost You Twice: Build Time, Runtime, and the Interview
- The Frontend Toolchain Is Now Written in Rust and Go. What That Means for You
- oxlint vs ESLint: Why I Replaced ESLint with oxlint
- SystemJS Is Dead. Native ESM Finally Won.
- Replace Axios with a Simple Custom Fetch Wrapper (Production-Ready Guide)
- Stop Shipping ChatGPT Wrappers. Ship an Agent in TypeScript, or Don't Bother.