cucumber-best-practices
БесплатноБез исполняемых скриптовНе проверенCucumber best practices, patterns, and anti-patterns
от TheBushidoCollective★ 202 звезды на GitHubОб этом скилле
Cucumber Best Practices
Master patterns and practices for effective Cucumber testing.
Scenario Design Principles
1. Write Declarative Scenarios
Focus on what needs to happen, not how it happens.
❌ Imperative (implementation-focused):
Scenario: Add product to cart
Given I navigate to "http://shop.com/products"
When I find the element with CSS ".product[data-id='123']"
And I click the button with class "add-to-cart"
And I wait for the AJAX request to complete
Then the element ".cart-count" should contain "1"
✅ Declarative (business-focused):
Scenario: Add product to cart
Given I am browsing products
When I add "Wireless Headphones" to my cart
Then my cart should contain 1 item
2. One Scenario, One Behavior
Each scenario should test exactly one business rule or behavior.
❌ Multiple behaviors in one scenario:
Scenario: User registration and login and profile update
Given I register a new account
When I log in
And I update my profile
And I change my password
Then everything should work
✅ Separate scenarios:
Scenario: Register new account
When I register with valid details
Then I should receive a confirmation email
Scenario: Login with new account
Given I have registered an account
When I log in with my credentials
Then I should see my dashboard
Scenario: Update profile
Given I am logged in
When I update my profile information
Then my changes should be saved
3. Keep Scenarios Independent
Each scenario should set up its own preconditions.
❌ Dependent scenarios:
Scenario: Create order
When I create order #12345
Scenario: View order
When I view order #12345 # Depends on previous scenario!
✅ Independent scenarios:
Scenario: View order
Given an order exists with ID "12345"
When I view the order details
Then I should see the order information
4. Use Background Wisely
Use Background for common setup, but don't overuse it.
✅ Good use of Background:
Feature: Shopping Cart
Background:
Given I am logged in as a customer
Scenario: Add product to cart
When I add a product to my cart
Then my cart should contain 1 item
Scenario: Remove product from cart
Given I have a product in my cart
When I remove the product
Then my cart should be empty
❌ Background doing too much:
Background:
Given I am on the homepage
And I click the menu
And I navigate to products
And I filter by category "Electronics"
And I sort by price
# Too much setup! Not all scenarios need all of this
Feature Organization
Group Related Scenarios
Feature: User Authentication
Scenario: Successful login
...
Scenario: Failed login with wrong password
...
Scenario: Account lockout after multiple failures
...
Use Tags Effectively
@smoke @critical
Scenario: Login with valid credentials
...
@slow @integration
Scenario: Password reset email workflow
...
@wip
Scenario: OAuth login
# Work in progress
...
Run specific tags:
# Run smoke tests
cucumber --tags "@smoke"
# Run all except WIP
cucumber --tags "not @wip"
# Run smoke AND critical
cucumber --tags "@smoke and @critical"
# Run smoke OR critical
cucumber --tags "@smoke or @critical"
Writing Good Gherkin
Use Domain Language
Write in the language of the business domain, not technical terms.
❌ Technical language:
Scenario: POST request to /api/users
When I send a POST to "/api/users" with JSON payload
And the response status is 201
✅ Domain language:
Scenario: Register new user
When I register a new user account
Then the user should be created successfully
Keep Steps at the Same Level
Don't mix high-level and low-level details.
❌ Mixed levels:
Scenario: Purchase product
Given I am logged in
When I add a product to cart
And I click the element with ID "checkout-btn" # Too detailed!
And I enter credit card "4111111111111111" # Too detailed!
Then I complete the purchase
✅ Consistent level:
Scenario: Purchase product
Given I am logged in
And I have a product in my cart
When I checkout with a credit card
Then my order should be completed
And I should receive a confirmation email
Avoid Conjunctive Steps
Don't use "And" to combine multiple distinct actions in prose.
❌ Conjunctive step:
When I log in and add a product to cart and checkout
✅ Separate steps:
When I log in
And I add a product to my cart
And I proceed to checkout
Scenario Outlines
Use for True Variations
Use Scenario Outlines when you need to test the same behavior with different data.
✅ Good use:
Scenario Outline: Login validation
When I log in with "<username>" and "<
Установить cucumber-best-practices в Claude Code и Claude Desktop
Зарегайся, чтобы установить скилл
Создай бесплатный аккаунт, чтобы открыть команду установки и сохранить скилл в библиотеку.
- Открой команду установки в одну строку
- Сохраняй скиллы в синхронизируемую библиотеку
- Уведомления, когда скиллы обновляются
Разрешённые инструменты
Инструменты, которые скиллу разрешено вызывать.
Без ограничений — скилл может использовать любой инструмент.
FAQ
Что делает скилл cucumber-best-practices?
Cucumber best practices, patterns, and anti-patterns
Как установить скилл cucumber-best-practices?
Скопируй папку скилла в ~/.claude/skills (вкладка Claude Code выше делает это одной командой), либо поставь как плагин.
Скилл cucumber-best-practices запускает скрипты?
Нет, скилл состоит только из инструкций (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