Skip to main content
Transform Cursor into a Bugster expert that can both generate comprehensive test specifications and automatically validate your UI changes as you build.

Two Cursor Use Cases for Bugster

Bugster provides two specialized Cursor rules to enhance your development workflow:
RuleWhen to UseActivationPurpose
Test GenerationBuilding test suitesManual (@bugster-test-rules)Create comprehensive test specifications
Quick ValidationAfter UI changesAutomatic (on file save)Validate implementation meets requirements

Using Cursor with Bugster

Cursor rules provide persistent context about your Bugster project, ensuring consistent test generation and automatic validation that follows your standards and best practices.
  • Project rules are stored in your repository and shared with your team.
  • User rules apply to your personal Cursor environment.
We recommend creating project rules for your Bugster project so that all contributors generate tests following the same standards. Create rules files in the .cursor/rules directory of your project. See the Cursor Rules documentation for complete setup instructions.

Test Generation Rule

This rule provides Cursor with context to properly generate Bugster test specifications following the required YAML structure and best practices.
File name suggestion: bugster-test-generation.mdc
Add this rule as a .mdc file in the .cursor/rules directory of your project:
---
alwaysApply: false
---
# Bugster Test Generation Rules

When creating Bugster test specifications, follow these strict requirements:

## YAML Structure (Non-negotiable)

```yaml
name: Descriptive test name
page: /route/path
page_path: relative/file/path.tsx # always relative to the frontend project (e.g., app/route.tsx); do not include a monorepo prefix like 'frontend/'
task: Clear test objective
steps:
  - Action 1
  - Action 2
  - Verification step
expected_result: Success criteria
```

**All fields are required. No exceptions.**

## page_path Requirements

- Must be the **relative path** to the actual page file being tested
- Examples:
  - `app/dashboard/users/page.tsx` (App Router)
  - `pages/auth/login.tsx` (Pages Router)  
  - `src/pages/products/[id].tsx` (Dynamic route)

## File Naming & Location

### File naming: snake_case, descriptive, .yaml extension
-`user_profile_edit_form.yaml`
-`login_authentication_flow.yaml`
-`userProfile.yaml` (camelCase)
-`test1.yaml` (not descriptive)

### File location: Mirror your app's filesystem hierarchy
```
# If page_path: app/dashboard/users/page.tsx
# Save to: .bugster/tests/dashboard/users/user_list_navigation.yaml

# If page_path: pages/auth/login.tsx
# Save to: .bugster/tests/auth/login_form_validation.yaml

# If page_path: src/components/profile/settings.tsx
# Save to: .bugster/tests/profile/settings_panel_functionality.yaml
```

## Test Generation Limits

**Before creating new tests:**
- Check existing tests in `.bugster/tests/` to avoid duplicates
- Review similar functionality that may already be covered
- Only create tests for uncovered scenarios

**Maximum 5 tests per feature** (unless user explicitly requests more)
- Focus on core functionality first
- Avoid repetitive test scenarios
- Quality over quantity - one comprehensive test is better than multiple redundant ones
- Stop early if core functionality is already covered

## Quick Reference

**Always provide:**
1. Complete YAML with all required fields
2. Correct relative page_path 
3. Proper snake_case filename suggestion
4. Full file path under `.bugster/tests/`

**Never:**
- Skip required fields
- Use absolute paths in page_path
- Suggest camelCase or space-separated filenames
- Place files outside `.bugster/tests/` hierarchy
- Generate more than 5 tests per feature without explicit request

How to Use the Rule

This rule is set to alwaysApply: false, meaning it only activates when explicitly tagged in your Cursor chat.

Manual Activation

To use the Bugster test generation rule, mention it explicitly in your Cursor chat:
@bugster-test-rules Generate a test for the user login page

Best Practices

Explicit Requests

Always tag the rule when you want Bugster-compliant test generation.

Check Existing Tests

Review .bugster/tests/ before generating new tests to avoid duplicates.

Quality Focus

Request comprehensive tests rather than many simple ones.

File Structure

Ensure generated tests follow your app’s hierarchy in .bugster/tests/.

Example Generated Test

When using the rule, Cursor will generate tests following this structure:
name: User login authentication flow
page: /auth/login
page_path: app/auth/login/page.tsx
task: Authenticate user with valid credentials and redirect to dashboard
steps:
  - Navigate to the login page
  - Fill in email field with valid email
  - Fill in password field with valid password
  - Click the login button
  - Verify redirect to dashboard occurs
  - Verify user session is established
expected_result: User should be successfully authenticated and redirected to the dashboard with an active session

Rule Customization

You can customize the rule for your specific project needs:
  • Framework-Specific
  • Monorepo Structure
  • Test Limits
Modify the page_path examples to match your framework:
  • Next.js App Router: app/route/page.tsx
  • Next.js Pages Router: pages/route.tsx
  • React Router: src/pages/route.tsx

Troubleshooting

  • Ensure you’re tagging the rule with @bugster-test-rules
  • Check that the rule file is saved in .cursor/rules/
  • Verify the rule has the correct .mdc extension
  • Review your project structure and update the rule examples
  • Ensure page_path examples match your framework conventions
  • Check that generated paths are relative, not absolute
  • The rule limits to 5 tests by default
  • Be more specific in your request to generate fewer tests
  • Review existing tests before requesting new ones

Quick Test Rule

This rule automatically validates your UI changes by running a comprehensive E2E test after you modify components or pages. It helps ensure your implementation meets user requirements.
File name suggestion: bugster-quick-test.mdc
E2E tests are slow (30-300 seconds). This rule is designed to run sparingly - only as final verification after code changes.
Add this rule as a .mdc file in the .cursor/rules directory of your project:
---
alwaysApply: true
description: Auto-validate UI changes with quick test after modifying components or pages
globs:
  - "**/*.tsx"
  - "**/*.jsx" 
  - "**/page.tsx"
  - "**/page.jsx"
---
# Bugster Quick Test Rules

## Context
Bugster is an E2E testing agent that executes UI tests in browsers. Tests are slow (30-300 seconds), so use sparingly.

## Use Case
**Validate from the UI that generated code respects user requirements** - use as final verification step after code generation.

## Auto-Trigger Behavior
**This rule should AUTOMATICALLY activate when:**
- Creating new UI components
- Modifying existing React components  
- Implementing user-facing features
- Making changes to pages or layouts

## When to Use
- **Only once at the end** of code generation process
- At the end of every change in the UI
- After implementing features that affect UI behavior
- To verify multiple aspects in a single comprehensive test
- **Never abuse** - execution takes up to 5 minutes

## Command Format
Always use these flags:

```bash
bugster run --prompt "{comprehensive validation description}" --silent --headless --output quick_validation.json
```

Add `--base-url http://localhost:PORT` if you opened the app in a new terminal.

## Prompt Guidelines
- **Be comprehensive** - validate multiple points in one test since you only get one shot
- Focus on core functionality the user requested
- Include key user flows and expected behaviors
- Mention specific UI elements or interactions to verify

## Example
```bash
bugster run --prompt "Test the new user registration form - verify all fields accept input, form submits successfully, validation works for empty fields, and user gets redirected to dashboard after signup" --silent --headless --base-url http://localhost:3000 --output quick_validation.json
```

## Rules
- **Maximum 1 execution per code generation session**
- Always include `--silent --headless --output quick_validation.json`
- Pack multiple validations into single comprehensive prompt
- Use only as final verification step

Combining Both Rules

For optimal workflow, use both rules together:
1

Setup

Add both rule files to your .cursor/rules directory:
  • bugster-test-generation.mdc (manual activation)
  • bugster-quick-test.mdc (auto-activation)
2

Development Flow

  1. Build your feature as requested
  2. Quick Test rule automatically validates the implementation
  3. Use Test Generation rule when you need comprehensive test suites
3

Team Consistency

Both rules ensure all team members follow the same Bugster standards and validation processes.
Start with the default rules and customize them as you learn your team’s testing patterns and preferences. The rules help maintain consistency across all contributors to your Bugster project.
I