behat-skill
/behat-skill
Generates Behat BDD tests for PHP with Gherkin feature files and MinkContext for browser testing. Use when user mentions "Behat", "PHP BDD", "Mink", "behat.yml". Triggers on: "Behat", "PHP BDD", "Mink", "behat.yml", "FeatureContext PHP".
- Author
- LambdaTest ↗
- Repository
- agent-skills ↗
- Licence
- MIT
- Last repository change
- 05.11.2026
Assessment and security
- Files in this package
- 3
- Scripts
- 0
- HTML comments
- 0
- URLs in SKILL.md
- 4
No signals detected. Repository changed on 05.11.2026, without references to retired models or APIs.
MIT, open: use and modify while retaining author attribution.
What it does and when to use it
Generates Behat BDD tests for PHP with Gherkin feature files and MinkContext for browser testing. Use when user mentions "Behat", "PHP BDD", "Mink", "behat.yml". Triggers on: "Behat", "PHP BDD", "Mink", "behat.yml", "FeatureContext PHP".
Triggers from the description
Original author description
Generates Behat BDD tests for PHP with Gherkin feature files and MinkContext for browser testing. Use when user mentions "Behat", "PHP BDD", "Mink", "behat.yml". Triggers on: "Behat", "PHP BDD", "Mink", "behat.yml", "FeatureContext PHP".
How it works
- Core Patterns
- Setup: composer require --dev behat/behat behat/mink-extension behat/mink-selenium2-driver
- Init: ./vendor/bin/behat --init
- Run: ./vendor/bin/behat or ./vendor/bin/behat features/login.feature
- Deep Patterns
SKILL.md preview
---
name: behat-skill
description: >
Generates Behat BDD tests for PHP with Gherkin feature files and MinkContext
for browser testing. Use when user mentions "Behat", "PHP BDD", "Mink",
"behat.yml". Triggers on: "Behat", "PHP BDD", "Mink", "behat.yml",
"FeatureContext PHP".
languages:
- PHP
category: bdd-testing
license: MIT
metadata:
author: TestMu AI
version: "1.0"
---
# Behat BDD Skill
## Core Patterns
### Feature File (features/login.feature)
```gherkin
Feature: User Login
As a user I want to log in
Scenario: Successful login
Given I am on "/login"
When I fill in "email" with "user@test.com"
And I fill in "password" with "password123"
And I press "Login"
Then I should see "Dashboard"
And I should be on "/dashboard"
Scenario: Invalid credentials
Given I am on "/login"
When I fill in "email" with "wrong@test.com"
And I fill in "password" with "wrong"
And I press "Login"
Then I should see "Invalid credentials"
```
### Custom Context (features/bootstrap/LoginContext.php)
```php
<?php
use Behat\MinkExtension\Context\MinkContext;
use Behat\Behat\Context\Context;
class LoginContext extends MinkContext implements Context
{
/**
* @When I login as :email with password :password
*/
public function iLoginAs(string $email, string $password): void
{
$this->visit('/login');
$this->fillField('email', $email);
$this->fillField('password', $password);
$this->pressButton('Login');
}
/**
* @Then I should see the dashboard
*/
public function iShouldSeeTheDashboard(): void
{
$this->assertSession()->addressEquals('/dashboard');
$this->assertSession()->pageTextContains('Welcome');
}
/**
* @Then the response time should be under :ms milliseconds
*/
public function responseUnder(int $ms): void
{
// Custom performance assertion
}
}
```
### Built-in MinkContext Steps
```gherkin
# Navigation
Given I am on "/path"
When I go to "/path"
When I reload the page
# Forms
When I fill in "field" with "value"
When I select "option" from "select"
When I check "checkbox"
When I uncheck "checkbox"
When I press "button"
When I attach the file "path" to "field"
# Assertions
Then I should see "text"
Then I should not see "text"
Then I should be on "/path"
Then the response status code should be 200
Then the "field" field should contain "value"
Then I should see an "css-selector" element
Then print current URL
```
### behat.yml
```yaml
default:
suites:
default:
contexts:
- LoginContext
- Behat\MinkExtension\Context\MinkContext
extensions:
Behat\MinkExtension:
base_url: 'http://localhost:3000'
sessions:
default:
selenium2:
browser: chrome
wd_host: 'http://localhost:4444/wd/hub'
```
### Tags
```bash
./vendor/bin/behat --tags=@smoke
./vendor/bin/behat --tags="@smoke&&~@slow"
```
## Setup: `composer require --dev behat/behat behat/mink-extension behat/mink-selenium2-driver`
## Init: `./vendor/bin/behat --init`
### Cloud Execution on TestMu AI
Set environment variables: `LT_USERNAME`, `LT_ACCESS_KEY`
```yaml
# behat.yml
default:
extensions:
Behat\MinkExtension:
base_url: 'https://your-app.com'
selenium2:
wd_host: 'https://hub.lambdatest.com/wd/hub'
capabilities:
browser: 'chrome'
extra_capabilities:
'LT:Options':
user: '%env(LT_USERNAME)%'
accessKey: '%env(LT_ACCESS_KEY)%'
build: 'Behat Build'
name: 'Behat Test'
platformName: 'Windows 11'
video: true
console: true
network: true
```
## Run: `./vendor/bin/behat` or `./vendor/bin/behat features/login.feature`
## Deep Patterns
See `reference/playbook.md` for production-grade patterns:
| Section | What You Get |
|---------|-------------|
| §1 Project Setup | behat.yml with suites, Mink extension, profiles, project structure |
| §2 Feature Files | Gherkin with Scenario Outline, Background, TableNode data |
| §3 Context Classes | Step definitions, dependency injection, API context, assertions |
| §4 Hooks | BeforeSuite/Scenario/Step, screenshot on failure, transaction rollback |
| §5 Page Objects | Page Object pattern with elements map, reusable components |
| §6 LambdaTest Integration | Remote Selenium config, cloud browser profiles |
| §7 Custom Formatters | HTML report formatter, result collection |
| §8 CI/CD Integration | GitHub Actions with MySQL, Selenium, JUnit reports |
| §9 Debugging Table | 12 common problems with causes and fixes |
| §10 Best Practices | 14-item BDD testing checklist |
Files in this package (3)
- SKILL.md 5 KB
- reference/advanced-patterns.md 3 KB
- reference/playbook.md 20 KB
Versions
The database has no other skills named behat-skill.
Database snapshot: 13.11.2026 · package version dba5bafac997 (SHA-256 digest of the entire package)
Downloads in the last 30 days: 0 · ranking
Report a problem with this skill: harmful content, incorrect descriptions or an author’s removal request.
Similar skills
- 100moodle-behat-testing
Use when writing or running Behat acceptance tests for Moodle plugins. Covers feature files, custom step definitions, tags, data generators in Background, JavaScript scenarios, and Selenium/Chromedriver setup. - 95behave-skill
Generates Behave BDD tests for Python with Gherkin feature files and step implementations. Use when user mentions "Behave", "Python BDD", "Python Gherkin". Triggers on: "Behave", "Python BDD", "behave test", "Python feature file". - 95cucumber-skill
Generates Cucumber BDD tests with Gherkin feature files and step definitions in Java, JavaScript, or Ruby. Use when user mentions "Cucumber", "Gherkin", "Feature/Scenario", "Given/When/Then", "BDD". Triggers on: "Cucumber", "Gherkin", "BDD", "Feature file", "Given/When/Then", "step definitions". - 100cucumber-skill
Generates Cucumber BDD tests with Gherkin feature files and step definitions in Java, JavaScript, or Ruby. Use when user mentions \"Cucumber\", \"Gherkin\", \"Feature/Scenario\", \"Given/When/Then\", \"BDD\". - 100cucumber-skill
Generates Cucumber BDD tests with Gherkin feature files and step definitions in Java, JavaScript, or Ruby. Use when user mentions \"Cucumber\", \"Gherkin\", \"Feature/Scenario\", \"Given/When/Then\", \"BDD\". - 100bdd
Behavior-Driven Development with Gherkin specifications and black-box testing. Use when working with BDD projects, writing feature files, implementing step definitions, or designing acceptance tests around observable behaviors. Triggers on: 'use bdd mode', 'bdd', 'behavior…