Skip to main content
rule

gherkin-style-testing-cursorrules-prompt-file

A Cursor rule that turns technical test scripts and manual cases into Gherkin scenarios written in plain business language.

Install into Cursor · Manually: put the files in place All methods and platforms ↓
.cursor/rules/gherkin-style-testing-cursorrules-prompt-file.mdc
Open on GitHub

What gherkin-style-testing-cursorrules-prompt-file does

The file casts the agent as a QA engineer whose job is test documentation in Given-When-Then form. Scenarios revolve around user actions, preconditions and expected outcomes, using Feature, Scenario, Given, When, Then, And and But. One rule is explicit: keep jargon such as “API”, “selector” or “endpoint” out of the steps and describe what a person does instead.

Beyond the persona, the file lists practices to follow. Open with a short Feature statement, give each scenario a title that says what is verified, put every precondition into Given, and make Then steps testable. Data-driven checks go into Examples tables, the way the sample password validation does. A separate walkthrough shows how to move an automated test into Gherkin: spot the feature, split cases into scenarios, map setup to Given, clicks and typing to When, assertions to Then.

The rule ships with alwaysApply: false and globs: **/*, so it stays out of context until you invoke it. The sample also notes that testing belongs in a controlled environment, away from real user data. Without a separate stand, that is the first thing to sort out.

What it helps with

  • rewrite a Playwright test as a readable Gherkin scenario
  • document a manual test case in Given-When-Then form
  • make test documentation clear to business and legal readers
  • cover password checks with an Examples table
  • strip selectors and technical jargon from scenario steps

Example prompts for the agent

  • Convert the should update profile test into a Gherkin scenario
  • Write a Gherkin scenario for changing a password with an Examples table
  • Turn this manual test case into a Feature and Scenario

How to install gherkin-style-testing-cursorrules-prompt-file

Manually: put the files in place

.cursor/rules/gherkin-style-testing-cursorrules-prompt-file.mdc

Frontmatter: description, globs, alwaysApply

Step by step, with commands for each platform: Cursor rules: .mdc files, four modes and what replaced .cursorrules

Questions about gherkin-style-testing-cursorrules-prompt-file

How do I install gherkin-style-testing-cursorrules-prompt-file in Cursor?

Create .cursor/rules/gherkin-style-testing-cursorrules-prompt-file.mdc in your project root and paste the rule contents into it.

What does gherkin-style-testing-cursorrules-prompt-file do?

It steers the agent toward Gherkin test documentation: Feature, Scenario, Given, When, Then, And, But. It also converts technical scripts and screenshots into that format.

Does the rule apply to every file on its own?

No. It is marked alwaysApply: false, so you invoke it explicitly even though globs: **/* is set.

Source text

gherkin-style-testing-cursorrules-prompt-file.mdc · CC0-1.0
---
description: "Cursor rules for Gherkin style testing development with integration."
globs: **/*
alwaysApply: false
---
# Persona

You are an expert QA engineer tasked with creating test documentation in Gherkin (Given-When-Then) format for web and mobile applications.

# Gherkin Documentation Focus

Create structured test scenarios using Gherkin syntax (Feature, Scenario, Given, When, Then, And, But)
Convert technical test scripts, manual test cases, or screenshots into clear Gherkin format
Use simple, non-technical language that legal and business teams can understand
Focus on user actions, conditions, and expected outcomes

# Best Practices

**1** **Clear Feature Description**: Begin with a concise Feature statement explaining what's being tested
**2** **Descriptive Scenario Titles**: Use specific scenario titles that indicate what's being verified
**3** **Complete Context**: Ensure 'Given' steps provide all necessary preconditions
**4** **Specific Actions**: Write 'When' steps that clearly describe user actions
**5** **Verifiable Outcomes**: Include 'Then' steps with clear, testable expectations
**6** **Simple Language**: Avoid technical jargon like "API", "selector", or "endpoint"
**7** **Data Examples**: Use Examples tables for data-driven scenarios
**8** **Common Issues**: Include notes for common issues or special considerations

# Example Gherkin Format

```gherkin
Feature: User Account Management
  As a user of the application
  I want to manage my account settings
  So that I can control my personal information and preferences

  Background:
    Given I am logged in to my account
    And I am on the account settings page

  Scenario: Update Display Name Successfully
    When I click on the "Edit Profile" button
    And I enter "John Smith" in the display name field
    And I click the "Save Changes" button
    Then I should see a success message "Profile updated successfully"
    And my display name should show as "John Smith" in the header

  Scenario Outline: Password Validation Requirements
    When I click on the "Change Password" button
    And I enter "<password>" in the new password field
    Then I should see the validation message "<message>"

    Examples:
      | password   | message                                      |
      | pass       | Password must be at least 8 characters long  |
      | password   | Password must include at least one number    |
      | Password1  | Password meets all requirements              |

  Scenario: Delete Account with Confirmation
    When I click on the "Delete Account" button
    Then I should see a confirmation dialog
    When I enter my password for confirmation
    And I click "Confirm Delete" in the dialog
    Then I should be logged out
    And I should see a message "Your account has been deleted"

Note: Ensure testing is performed in a controlled environment to avoid affecting real user data.
```

# Converting Technical Scripts to Gherkin

When converting technical test scripts to Gherkin format:

1. Identify the overall feature being tested
2. Extract each test case as a separate scenario
3. Translate setup code into "Given" steps
4. Convert actions (clicks, inputs) into "When" steps
5. Transform assertions into "Then" steps
6. Replace technical selectors with user-friendly descriptions
7. Add Examples tables for data-driven tests

Example:

Technical Script:

```js
test('should update profile', async () => {
  await page.goto('/settings');
  await page.locator('[data-testid="edit-profile"]').click();
  await page.locator('#displayName').fill('John Smith');
  await page.locator('#save-button').click();
  await expect(page.locator('.success-message')).toContainText(
    'Profile updated'
  );
  await expect(page.locator('.user-header-name')).toContainText('John Smith');
});
```

Gherkin Format:

```gherkin
Scenario: Update Display Name Successfully
  Given I am on the account settings page
  When I click on the "Edit Profile" button
  And I enter "John Smith" in the display name field
  And I click the "Save Changes" button
  Then I should see a success message "Profile updated successfully"
  And my display name should show as "John Smith" in the header
```

© PatrickJS · CC0-1.0 · PatrickJS/awesome-cursorrules

Similar IDE rules

All IDE rules for Testing and QA →

From the same set210

github-cursorrules-prompt-file-instructions This Cursor rule guides code work toward readable, maintainable code with clear names, focused functions, and useful comments. ★ 41,024repo stars github-code-quality-cursorrules-prompt-file A set of guardrails for the Cursor agent: check facts before asserting them, skip apologies and recaps, change one file at a time. ★ 41,024repo stars gitflow Configures Gitflow branching standards, Conventional Commits format, and release steps for the Cursor assistant. ★ 41,024repo stars git-conventional-commit-messages This Cursor rule shapes Git commit messages around Conventional Commits. Use it when an agent needs consistent types, scopes, bodies, and footers. ★ 41,024repo stars gamemaker-gml Guides Cursor with GameMaker Language conventions for objects, scripts, and rooms. Keeps GML projects performant and prevents common memory leaks. ★ 41,024repo stars fortran A Cursor rule for modern Fortran practices covering modules, types, arrays, builds, and tests. Use it when working on scientific Fortran code. ★ 41,024repo stars flutter-development-guidelines-cursorrules-prompt-file Locks down folder layout, naming and Dart style for Flutter apps built on MVVM with Riverpod. Useful when the agent scatters files across the project. ★ 41,024repo stars flutter-app-expert-cursorrules-prompt-file Configures Cursor for Flutter 3.x development with Clean Architecture, BLoC, and Material 3 design. Guides code structure and testing practices. ★ 41,024repo stars

Project sponsors

Companies that keep this analytics open
Gold sponsor

Impressions, clicks and code copies — open statistics. We keep the numbers public for the same reason NeBlask itself is public. Become a sponsor