Skip to main content

Automation Testing Prompts

This section provides prompts designed to help you create effective automated test scripts and frameworks using AI. These prompts ensure maintainable and reliable test automation.

Basic Automation Test Generation

Important Notes

Some important notes that can help with is to iterate your prompts, meaning that you take a bigger task and break it down into smaller ones. So instead of ask chatGPT to build a whole automation stack with one prompt, better to focus on one part of the automation and edit manually when needed. This process I find yields the best results.

Basic Automation Test Generation

Prompt Template

Example Usage

Advanced Automation Testing

Framework Setup

API Automation

Best Practices

When using these prompts:
  1. Follow Design Patterns
    • Page Object Model
    • Factory Pattern
    • Builder Pattern
    • Strategy Pattern
  2. Maintain Code Quality
    • Clean code principles
    • Code organization
    • Documentation
    • Version control
  3. Handle Test Data
    • Data management
    • Test data generation
    • Data cleanup
    • Data isolation
  4. Implement Reporting
    • Test results
    • Screenshots
    • Logs
    • Metrics

Tips for Better Results

  1. Start with Framework
    • Choose appropriate tools
    • Set up project structure
    • Configure dependencies
    • Implement base classes
  2. Organize Tests
    • Logical grouping
    • Clear naming
    • Proper structure
    • Easy maintenance
  3. Handle Dependencies
    • External services
    • Database
    • File system
    • Network
  4. Implement CI/CD
    • Automated builds
    • Test execution
    • Reporting
    • Notifications

Common Pitfalls to Avoid

  1. Poor Framework Design
    • ❌ “Write test scripts”
    • ✅ “Implement Page Object Model with reusable components and proper abstraction”
  2. Missing Error Handling
    • ❌ “Basic test cases”
    • ✅ “Comprehensive test cases with proper error handling and recovery mechanisms”
  3. Inadequate Reporting
    • ❌ “Run tests”
    • ✅ “Run tests with detailed reporting, screenshots, and performance metrics”
  4. Poor Maintenance
    • ❌ “Fix when broken”
    • ✅ “Regular code reviews, updates, and refactoring to maintain code quality”

Example Output Structure

Resources