Idea: First-class Gherkin (.feature) support in Pest
#1690
lkmadushan
started this conversation in
Ideas
Replies: 0 comments
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Uh oh!
There was an error while loading. Please reload this page.
-
Title suggestion
Native Gherkin /
.featurefile support — replace the need for BehatTL;DR
Let Pest parse and execute
.featurefiles directly, with step definitions written in Pest's normal expressive style. Today, teams that want both unit/feature tests and BDD-style acceptance tests have to run Pest and Behat side-by-side — two runners, two configs, two reporters, two mental models. A first-party Gherkin layer in Pest would collapse that into one tool.This has become noticeably more valuable in the AI-assisted ("vibe coding") workflow, where Gherkin is an excellent specification handoff format between human and LLM.
Problem
In a typical Laravel/PHP project today, the BDD setup looks like:
phpunit.xml+tests/for Pestbehat.yml+features/+FeatureContext.phpfor BehatConcretely, a project I'm working on right now has both
./vendor/bin/pestand./vendor/bin/behatwired into CI, with overlapping bootstrap code. Maintaining two parallel test stacks just to get Gherkin is a real cost.Proposal
Pest discovers
*.featurefiles (configurable path, e.g.features/) and executes them as test cases. Steps are defined in PHP using Pest's existing DSL — something like:Run with the same command everyone already uses:
Output, filtering (
--filter), parallelism (--parallel), coverage, and plugins all come for free because it's just Pest.Example feature file (unchanged from Behat-style)
Why now: AI-assisted development
Gherkin's value has gone up in the LLM era, not down:
Given/When/Thenis unambiguous, structured, and human-readable. A non-technical stakeholder can write or review a.featurefile; an AI coding assistant can read it and generate both step definitions and production code from it..feature→ AI writes step defs → AI writes implementation → tests go green. Today that workflow is awkward because the AI has to context-switch between Behat conventions and the Pest conventions used by the rest of the suite.A unified Pest+Gherkin would make Pest the default acceptance-testing tool for AI-driven PHP development.
Why Pest specifically
Out of scope / open questions
:roomas int,:textas string), expand later.Background,Before,After) map naturally onto Pest'sbeforeEach/afterEach.pestphp/pest-plugin-gherkin) before being merged into core.What I'd love feedback on
Posting this because I'm currently running Pest and Behat side-by-side on a Laravel project and the duplication is painful — especially when handing context to an AI assistant. Happy to help prototype if there's interest.
Beta Was this translation helpful? Give feedback.
All reactions