Home Developers Prompts Testing

AI Prompts for Testing

20 framework-tagged, copy-paste templates for Developers — Testing.
Works with ChatGPT, Claude, and Gemini.

21 Ready Prompts
Copy with One Click
Framework-Tagged

21 Prompts — Testing

Click any prompt to copy
Unit Test Generator
TDD

Write comprehensive unit tests for this function:
[function code]
Framework: [Jest/PyTest/JUnit/RSpec/etc.]. Language: [language].
Cover: happy path (3 cases), edge cases (empty/null/zero/max), error cases (invalid input, thrown exceptions), and boundary values. For each test: descriptive name, arrange-act-assert structure, and a comment explaining what invariant is being tested. Aim for 90%+ branch coverage.

Integration Test Design
Zero-Shot

Design integration tests for the interaction between [component A] and [component B].
Language: [language]. Test framework: [framework]. Integration point: [API call/database/message queue/etc.].
Define: test scenarios (5 min), test data setup/teardown strategy, whether to use real dependencies or test doubles (justify each), and how to make the tests deterministic. Write the 3 most critical integration tests.

E2E Test Scenarios
User Story

Write end-to-end test scenarios for the feature: [feature name].
User story: [as a user, I want to...]. Test tool: [Playwright/Cypress/Selenium].
Define: 5 E2E scenarios (happy path, sad paths, edge cases). For each: preconditions, test steps (action + expected result), and the assertion that proves success. Include 1 test for mobile viewport and 1 for keyboard-only navigation (accessibility).

Test Plan Document
MECE

Write a test plan for the release of [feature/product version].
Release date: [date]. Risk level: [high/medium/low]. Team size: [QA team size].
Sections: scope (what's tested + what's not), test approach (unit/integration/E2E/exploratory ratios), entry and exit criteria, test environment setup, test data requirements, risk-based prioritisation, defect reporting process, and sign-off criteria.

Test Data Factory
Zero-Shot

Write a test data factory for the [entity: User/Order/Product] model in [language].
Model schema: [describe fields + types]. Framework: [factory_boy/FactoryGirl/Faker/etc.].
Create: a default factory with realistic values, 5 trait variations (admin user, suspended user, etc.), a sequence for unique fields, relationship factories (e.g., user with N orders), and a guide on how to override specific fields in tests.

Mock and Stub Design
Zero-Shot

Design the mocking strategy for testing [component] that depends on: [list external dependencies].
Language: [language]. Test framework: [framework].
For each dependency: should it be mocked or use a real test double (explain why), how to set up the mock, what the mock should return for each test scenario, and how to verify the component interacted with the dependency correctly. Include code examples.

Performance Test Plan
Zero-Shot

Write a performance test plan for [system/feature].
Tool: [k6/Locust/JMeter/Gatling]. SLA targets: response time p95 < [ms], error rate < [%], throughput > [RPS].
Define: baseline test (current load), stress test (2× expected), spike test (sudden 10× burst), and endurance test (sustained load for 30 min). For each: setup script outline, ramp-up pattern, success criteria, and what to do when each threshold is breached.

Accessibility Test Checklist
WCAG

Create an accessibility testing checklist for [web application/component].
WCAG level target: [AA/AAA]. Testing approach: [automated + manual].
Checklist categories: keyboard navigation (8 items), screen reader compatibility (6 items), colour and contrast (5 items), form accessibility (7 items), images and media (5 items), dynamic content (5 items). For each item: what to test, tool/method, pass/fail criteria.

Security Test Cases
OWASP

Write security test cases for [feature/endpoint].
Stack: [language + framework]. Security controls in place: [auth/validation/etc.].
Test cases for: SQL injection, XSS (stored + reflected), CSRF, broken authentication (brute force, session fixation), insecure direct object reference, and mass assignment. For each: test input, expected secure response, and how to verify the control is working.

Regression Test Suite Design
Zero-Shot

Design a regression test suite for a [web/mobile/API] application with [number] features.
Current problem: [slow tests/flaky tests/incomplete coverage].
Define: which features need regression tests (risk-based prioritisation), test pyramid balance (unit/integration/E2E ratio), how to keep the suite fast (parallel execution, test splitting), flakiness reduction approach, and a maintenance schedule to keep tests aligned with the product.

Test Coverage Gap Analysis
Zero-Shot

Analyse the test coverage for this codebase:
Current coverage: [% + which files are covered]. Coverage tool: [Istanbul/Coverage.py/JaCoCo]. Untested areas: [list of files or modules with low coverage].
Prioritise which gaps to fill first (by: risk × usage frequency). Write 5 test cases for the highest-risk untested path. Recommend a coverage target (not necessarily 100%) and explain why.

BDD Scenario Writing
Gherkin

Write BDD test scenarios in Gherkin syntax for the feature: "[feature name]".
User story: [story]. Business rule: [rule].
Write 5 scenarios using Given-When-Then. Include: happy path (2 scenarios), alternative flow (1), error/edge case (2).
Scenarios must be business-readable (no technical implementation details). Add a Background section if multiple scenarios share setup. Note any scenario outlines for data-driven tests.

Contract Testing Design
Zero-Shot

Design consumer-driven contract tests between [consumer service] and [provider service].
API type: [REST/GraphQL/gRPC/message]. Tool: [Pact/Spring Cloud Contract].
Define: interactions to test (3 consumer expectations), provider states needed, contract negotiation process, how to run contract tests in CI (consumer first, then provider), and what happens when the contract is broken (who gets notified + how to resolve).

Load Test Script
Zero-Shot

Write a load test script using [k6/Locust] for the [API endpoint or user flow].
Scenario: ramp from [start] to [max] virtual users over [duration].
Script includes: realistic think time between requests, authentication setup, the core user flow (3–5 API calls), custom metrics for business-level SLAs (not just HTTP), assertions on p95 latency < [ms] and error rate < [%], and a summary output format.

Visual Regression Testing Setup
Zero-Shot

Set up a visual regression testing workflow for [web application].
Framework: [Percy/Chromatic/Playwright screenshots/BackstopJS]. CI: [GitHub Actions/GitLab].
Define: which pages/components to capture (priority list), viewport sizes to test, how to handle dynamic content (masking/ignoring selectors), baseline update process, review workflow for visual diffs, and how to integrate into the PR review process without slowing it down.

Test Pyramid Implementation
Zero-Shot

Implement the test pyramid for a [language/framework] project.
Current state: [describe existing tests]. Pain: [too slow/too brittle/too many E2E].
Target pyramid: [70% unit / 20% integration / 10% E2E]. For each layer: what types of tests belong there, what NOT to test at this layer, tool recommendation, example test case, and a migration plan to get from the current state to the target in 4 sprints.

CI/CD Test Integration
Zero-Shot

Design the test integration for a CI/CD pipeline for [project].
CI tool: [GitHub Actions/GitLab CI/Jenkins]. Test types: [unit/integration/E2E/security]. Current pipeline time: [minutes]. Target: [minutes].
Define: which tests run on every commit, which run only on PR merge, which run nightly, how to parallelise, how to fail fast without skipping critical tests, and how to surface test results for non-engineers.

QA Automation Strategy
PREP

Write a QA automation strategy for [product].
Team: [1 QA / 3 QA / shared dev-QA]. Current coverage: [% + which areas]. Next 6 months goal: [goal].
Sections: current state assessment, automation target areas (prioritised by ROI), tool selection (with justification), implementation plan (phased over 6 months), metrics to track automation ROI, and how to prevent the automation suite from becoming a maintenance burden.

Test Environment Management
Zero-Shot

Design the test environment strategy for [product].
Environments needed: [dev/staging/QA/performance]. Infrastructure: [cloud/on-prem]. Team: [dev + QA size].
Define: what makes each environment different (config, data, scale), how environments are provisioned (IaC), data management (anonymised prod data vs synthetic), environment refresh cadence, and how to handle environment contention between parallel teams.

Test Flakiness Elimination
Zero-Shot

Help me eliminate test flakiness in our test suite.
Test framework: [framework]. Flaky test rate: [%]. Common failure patterns observed: [patterns].
Systematic approach: how to identify all flaky tests (quarantine strategy), root cause categories (timing/state/network/randomness), fix pattern for each category with code examples, how to prevent new flaky tests (linting rules, PR checklist), and a flakiness tracking dashboard design.

Mutation Testing Setup
Zero-Shot

Set up mutation testing for a [language] project to measure true test effectiveness.
Framework: [Stryker/PITest/mutmut]. Project size: [LOC]. Current unit test coverage: [%].
Explain: what mutation testing is and why coverage % alone is misleading, how to configure the tool for this project, which source files to mutate first (highest business risk), how to interpret the mutation score, and a realistic target score for this codebase.

How to use these prompts
  • Replace [placeholders in brackets] with your specific details before sending.
  • Add context about your audience, tone, or format to get more tailored results.
  • Chain prompts — use one output as input to the next for complex tasks.
  • Works with ChatGPT, Claude, Gemini, and other LLMs.
Build Custom Prompts

Use our AI prompt builder to create prompts tailored to your exact situation.

Try Prompt Builder
Learn the Frameworks

The badges on each prompt reference proven prompt engineering frameworks.

Browse 60+ Frameworks →
All Developers Prompts