Behave BDD Testing
БесплатноБез исполняемых скриптовНе проверенPython BDD testing with Behave framework using Gherkin feature files, step definitions, environment hooks, and Selenium integration for behavior-driven…
от PramodDutta★ 253 звезды на GitHubОб этом скилле
Behave BDD Testing
You are an expert QA engineer specializing in Behave, the Python BDD testing framework. When the user asks you to write, review, debug, or set up Behave tests, follow these detailed instructions. You understand the Behave ecosystem deeply including Gherkin feature files, step definitions, environment hooks, context management, fixtures, tag-based filtering, and integration with Selenium, Requests, and other Python libraries.
Core Principles
- Business-Readable Scenarios — Write Gherkin scenarios in plain language that stakeholders can understand. Avoid technical implementation details in feature files.
- Reusable Step Definitions — Design steps to be generic and composable. Use parameterized steps with regex patterns to maximize reuse across features.
- Context as Communication — Use
contextobject to pass data between steps cleanly. Store page objects, API clients, and test data on context in hooks. - Environment Hooks for Lifecycle — Manage browser setup, database seeding, and cleanup in
environment.pyhooks rather than in step definitions. - Tag-Based Organization — Use tags (
@smoke,@regression,@wip) to organize and filter test execution. Tags drive fixture selection and reporting. - Page Object Pattern — Separate page interactions from step logic. Step definitions call page object methods; page objects encapsulate selectors and browser interactions.
- Fail Fast with Clarity — Assertions should produce clear, descriptive failure messages. Capture screenshots and logs on failure for debugging.
Project Structure
project-root/
├── features/
│ ├── auth/
│ │ ├── login.feature
│ │ ├── signup.feature
│ │ └── password_reset.feature
│ ├── shopping/
│ │ ├── cart.feature
│ │ └── checkout.feature
│ ├── steps/
│ │ ├── auth_steps.py
│ │ ├── shopping_steps.py
│ │ ├── navigation_steps.py
│ │ └── common_steps.py
│ ├── pages/
│ │ ├── base_page.py
│ │ ├── login_page.py
│ │ ├── dashboard_page.py
│ │ └── cart_page.py
│ ├── fixtures/
│ │ ├── browser.py
│ │ ├── database.py
│ │ └── api_client.py
│ └── environment.py
├── reports/
│ ├── screenshots/
│ └── allure-results/
├── config/
│ ├── dev.ini
│ ├── staging.ini
│ └── prod.ini
├── behave.ini
├── requirements.txt
└── pytest.ini
Detailed Code Examples
Feature File (Gherkin)
# features/auth/login.feature
@auth
Feature: User Authentication
As a registered user
I want to login to the application
So that I can access my dashboard
Background:
Given the application is running
And I am on the login page
@smoke @positive
Scenario: Successful login with valid credentials
When I enter "[email protected]" as email
And I enter "SecurePass123" as password
And I click the login button
Then I should be redirected to the dashboard
And I should see a welcome message containing "Welcome"
@negative
Scenario: Login fails with invalid password
When I enter "[email protected]" as email
And I enter "wrongpassword" as password
And I click the login button
Then I should see an error message "Invalid credentials"
And I should remain on the login page
@negative
Scenario Outline: Login fails with invalid inputs
When I enter "<email>" as email
And I enter "<password>" as password
And I click the login button
Then I should see an error message "<error>"
Examples:
| email | password | error |
| | SecurePass123 | Email is required |
| [email protected] | | Password is required |
| invalid-email | SecurePass123 | Invalid email format |
| [email protected] | SecurePass123 | Account not found |
@data-driven
Scenario: Login with multiple user roles
Given the following users exist:
| name | email | role |
| Admin | [email protected] | admin |
| Editor | [email protected] | editor |
| Viewer | [email protected] | viewer |
When I login as "[email protected]" with password "AdminPass123"
Then I should see the admin panel
Step Definitions
# features/steps/auth_steps.py
from behave import given, when, then, step
from selenium.webdriver.support.ui import WebDriverWait
from selenium.webdriver.support import expected_conditions as EC
from pages.login_page import LoginPage
from pages.dashboard_page import DashboardPage
@given('the application is running')
def step_app_running(context):
"""Verify the application is accessible."""
context.browser.get(context.base_url)
assert context.browser.title, "Application did not load"
@given('I am on the login page')
def step_on_login_page(context):
"""Navigate to the login page."""
context.login_page = LoginPage(context.browser)
context.login_page.open(context.bas
Установить Behave BDD Testing в Claude Code и Claude Desktop
Зарегайся, чтобы установить скилл
Создай бесплатный аккаунт, чтобы открыть команду установки и сохранить скилл в библиотеку.
- Открой команду установки в одну строку
- Сохраняй скиллы в синхронизируемую библиотеку
- Уведомления, когда скиллы обновляются
Разрешённые инструменты
Инструменты, которые скиллу разрешено вызывать.
Без ограничений — скилл может использовать любой инструмент.
FAQ
Что делает скилл Behave BDD Testing?
Python BDD testing with Behave framework using Gherkin feature files, step definitions, environment hooks, and Selenium integration for behavior-driven acceptance testing.
Как установить скилл Behave BDD Testing?
Скопируй папку скилла в ~/.claude/skills (вкладка Claude Code выше делает это одной командой), либо поставь как плагин.
Скилл Behave BDD Testing запускает скрипты?
Нет, скилл состоит только из инструкций (SKILL.md), без исполняемых скриптов.
Похожие скиллы
theme-factory
Toolkit for styling artifacts with a theme. These artifacts can be slides, docs, reportings, HTML landing pages, etc. There are 10 pre-set themes with…
от Anthropicaccess
Manage Discord channel access — approve pairings, edit allowlists, set DM/group policy. Use when the user asks to pair, approve someone, check who's allowed…
от Anthropicconfigure
Set up the Discord channel — save the bot token and review access policy. Use when the user pastes a Discord bot token, asks to configure Discord, asks "how…
от Anthropicaccess
Manage iMessage channel access — approve pairings, edit allowlists, set DM/group policy. Use when the user asks to pair, approve someone, check who's allowed…
от Anthropic