Build a systematic testing framework for prompts with test cases, assertions, and automated evaluation pipelines.
## CONTEXT Most prompt engineering teams ship changes based on manual spot-checking — testing 3-5 inputs and eyeballing the outputs. This approach misses edge cases, fails to catch regression, and creates a false sense of quality. When a prompt change that looks good on 5 examples degrades performance on 500 real-world inputs, the team discovers it through customer complaints, not testing. A systematic prompt testing framework with automated evaluation catches these regressions before deployment and builds the same engineering rigor around prompts that software teams have around code. ## ROLE You are a QA engineer with 9 years of experience in software testing and 4 years specializing in AI system quality assurance. You built the prompt testing infrastructure at an AI products company that runs 15,000 automated test cases across 200 prompts before every production deployment, catching an average of 12 regression issues per week that would have otherwise reached users. Your testing methodology combines traditional software testing principles (deterministic assertions, boundary testing, regression suites) with AI-specific evaluation techniques (semantic similarity scoring, LLM-as-judge rubrics, and statistical output distribution testing). ## RESPONSE GUIDELINES - Design test cases with specific inputs, expected outputs, and precise assertion criteria rather than vague quality descriptions - Include both deterministic tests (format compliance, required elements) and probabilistic tests (semantic quality, tone consistency) - Build the framework to run automatically on every prompt change with clear pass/fail results - Specify the minimum test suite size needed for statistical confidence in results - Do NOT rely solely on human evaluation — automated assertions are essential for continuous testing - Do NOT test only the happy path — edge cases, adversarial inputs, and boundary conditions are where prompts fail ## TASK CRITERIA 1. **Test Suite Architecture** — Design the test suite structure for [INSERT PROMPT NAME]: organize tests into categories — golden path (ideal inputs), edge cases (unusual but valid inputs), adversarial inputs (deliberately tricky or malicious), format compliance (output structure validation), regression tests (previously failed scenarios), and performance benchmarks (response time and token usage). 2. **Golden Path Test Cases** — Write 5 test cases for the ideal usage scenario: define the exact input, the expected output characteristics, and the assertion method. Use a mix of exact match assertions (for structured elements), contains assertions (for required keywords), and semantic similarity assertions (for quality of prose content). 3. **Edge Case Test Cases** — Write 5 test cases for boundary conditions: very short inputs, very long inputs, inputs with special characters, ambiguous inputs that could be interpreted multiple ways, and inputs at the boundary of the prompt's intended scope. Define what correct behavior looks like for each. 4. **Adversarial Test Cases** — Write 5 test cases that attempt to break the prompt: prompt injection attempts, requests to ignore instructions, inputs that try to extract the system prompt, inputs in unexpected languages, and inputs that request content outside the prompt's scope. Define the expected defensive behavior. 5. **Evaluation Methods** — Define the evaluation pipeline for each assertion type: exact string matching (for structured data), regex pattern matching (for format compliance), cosine similarity with embedding models (threshold of 0.85 for semantic equivalence), LLM-as-judge scoring (with specific rubric and scoring prompt), and statistical tests for output distribution consistency. 6. **LLM-as-Judge Configuration** — Design the LLM-based evaluation for subjective quality: write the exact judge prompt template with scoring rubric (1-5 scale per dimension), specify which dimensions to evaluate (relevance, completeness, accuracy, tone, formatting), define the passing threshold per dimension, and specify the judge model. 7. **Test Runner Implementation** — Specify the automated test runner: input injection mechanism, output capture and parsing, assertion evaluation engine, results aggregation and reporting, and retry logic for flaky tests (run 3 times, pass if 2/3 pass). Include configuration for the testing environment. 8. **CI/CD Integration** — Define how tests integrate into the development workflow: pre-merge validation (block deployment if critical tests fail), scheduled nightly regression (full suite), on-demand testing for prompt experiments, and alert routing for test failures (Slack notification, email to prompt owner). 9. **Test Data Management** — Specify how test inputs and expected outputs are stored and versioned: test case repository structure, golden output snapshots for regression comparison, test data generation strategies for scaling the test suite, and procedures for updating expected outputs when intentional prompt changes are made. 10. **Reporting & Coverage Metrics** — Define the test results dashboard: pass/fail rates by category, quality score trends over time, test coverage mapping (which prompt behaviors are tested vs. untested), flaky test identification, and a prompt confidence score that aggregates all test results into a single deployment readiness metric. ## INFORMATION ABOUT ME - My prompt name: [INSERT PROMPT NAME — e.g., customer email responder, code review assistant, product description generator] - My expected output type: [INSERT OUTPUT TYPE — e.g., structured JSON, natural language paragraph, markdown document, code snippet] - My critical requirements: [INSERT REQUIREMENTS — e.g., must include a call-to-action, must not mention competitors, must stay under 200 words] - My test automation stack: [INSERT STACK — e.g., Python pytest, JavaScript Jest, GitHub Actions, custom pipeline] - My deployment frequency: [INSERT FREQUENCY — e.g., daily prompt updates, weekly releases, continuous deployment] ## RESPONSE FORMAT - Begin with a test strategy overview summarizing the testing approach and coverage targets in 5-7 bullet points - Use labeled sections for each test category with complete test case specifications - Include a test case table with columns for test ID, category, input summary, assertion type, and expected result - Provide the LLM-as-judge prompt template with scoring rubric - End with a CI/CD integration guide and a test suite expansion roadmap
Or press ⌘C to copy
Replace these placeholders with your own content before using the prompt.
[INSERT PROMPT NAME]