Generating acceptance criteria from product requirement documents is a repetitive but critical task in software development. When you’re working with vague requirements, turning them into testable conditions requires careful analysis. AI tools can accelerate this process significantly, helping you extract measurable criteria from natural language documents.
This guide shows you practical approaches to generate acceptance criteria using AI, with concrete examples you can apply immediately.
Understanding the Input: Product Requirement Documents
Product requirement documents (PRDs) come in various formats—Google Docs, Confluence pages, Notion files, or plain text. Most contain a mix of user stories, feature descriptions, business rules, and technical constraints. The challenge is extracting unambiguous, testable conditions from these documents.
A typical PRD entry might look like this:
User Authentication Feature
- Users should be able to register with email and password
- Password must be at least 8 characters
- Users receive a confirmation email after registration
- Login should work with email and password
- Session expires after 30 minutes of inactivity
From this brief description, you need to generate specific acceptance criteria that QA can test and developers can implement.
Prompting AI to Extract Acceptance Criteria
The key to getting useful output is providing clear context. Here’s a structured approach:
Extract acceptance criteria from the following product requirement.
For each criterion, use the format:
- Condition: [what must be true]
- Verification: [how to test it]
Requirements:
[Your PRD content here]
Example: Authentication Feature
Input PRD:
Registration System
New users create accounts using email address. Password requirements:
minimum 8 characters, at least one uppercase letter, one number, and one
special character. System sends verification email with link. User must
click link within 24 hours to activate account.
AI-generated acceptance criteria:
| ID | Condition | Verification |
|—-|———–|————–|
| AC-1 | Email field accepts valid email format | Submit form with test@, test@test, test@test.test |
| AC-2 | Email field rejects invalid formats | Submit with no @, missing TLD, spaces |
| AC-3 | Password minimum 8 characters | Submit 7-character password, verify rejection |
| AC-4 | Password requires uppercase | Submit “password1!” verify rejection |
| AC-5 | Password requires number | Submit “Password!” verify rejection |
| AC-6 | Password requires special character | Submit “Password1” verify rejection |
| AC-7 | Verification email sent | Check inbox after registration |
| AC-8 | Link expires after 24 hours | Click link after 24h, verify failure |
| AC-9 | Account inactive until verified | Attempt login before verification |
Automating with CLI Tools
For teams processing multiple requirements, you can build a simple CLI tool using the OpenAI API or Claude API:
#!/usr/bin/env python3
import sys
import json
def generate_acceptance_criteria(prd_text, api_key):
"""Send PRD to AI and parse response into structured criteria."""
from openai import OpenAI
client = OpenAI(api_key=api_key)
prompt = f"""Analyze this product requirement and generate
acceptance criteria in JSON format.
Requirements:
{prd_text}
Output format:
{{
"criteria": [
{{"id": "AC-1", "condition": "...", "verification": "..."}}
]
}}"""
response = client.chat.completions.create(
model="gpt-4o",
messages=[{"role": "user", "content": prompt}]
)
return json.loads(response.choices[0].message.content)
if __name__ == "__main__":
prd = sys.argv[1] if len(sys.argv) > 1 else ""
criteria = generate_acceptance_criteria(prd, sys.argv[2])
print(json.dumps(criteria, indent=2))
Run it with:
python ac_generator.py "Your PRD text here" "your-api-key"
Handling Complex Business Rules
Real-world requirements often contain nested logic. Here’s how to handle them:
E-commerce Discount Rules:
- Orders over $100 get 10% discount
- Orders over $200 get 15% discount
- Members get additional 5% off
- Discounts stack but max 20%
- Free shipping on orders over $50
A good prompt for this scenario:
Break down the following business rules into individual test cases.
For each test case, include: input, expected output, and edge case notes.
Rules:
[Your business rules]
This produces testable scenarios like:
| Input | Expected | Notes |
|——-|———-|——-|
| $100 order, non-member | 10% discount | Threshold met |
| $200 order, non-member | 15% discount | Higher tier applies |
| $200 order, member | 20% discount | Capped at max |
| $49 order | No discount, shipping cost | Below threshold |
| $100 order, member | 15% discount | 10%+5%, capped |
Integration with Test Management
For automated test generation, output criteria in a format your framework understands:
# Pytest-compatible output
ACCEPTANCE_CRITERIA = {
"AC-1": {
"condition": "Email validation works",
"test_cases": [
{"input": "valid@email.com", "expected": True},
{"input": "invalid-email", "expected": False},
{"input": "@domain.com", "expected": False},
]
},
"AC-2": {
"condition": "Password complexity enforced",
"test_cases": [
{"input": "Pass123!", "expected": True},
{"input": "short", "expected": False},
{"input": "nouppercase1!", "expected": False},
]
}
}
You can then generate pytest tests programmatically:
import pytest
from your_acceptance_module import ACCEPTANCE_CRITERIA
def generate_tests():
for ac_id, ac_data in ACCEPTANCE_CRITERIA.items():
condition = ac_data["condition"]
for tc in ac_data["test_cases"]:
test_name = f"test_{ac_id}_{tc['expected']}"
@pytest.mark.parametrize("inp,exp", [(tc['input'], tc['expected'])])
def test_wrapper(inp, exp):
assert validate(condition, inp) == exp
globals()[test_name] = test_wrapper
Best Practices for Better Results
Provide context in your prompts. Include information about your tech stack, testing framework, and any existing conventions. This helps AI generate criteria that fit your workflow.
Review and refine. AI output is a starting point. Always have a developer or QA engineer review generated criteria for completeness and accuracy.
Iterate on prompts. If output quality is poor, adjust your prompt with more specific instructions. Include examples of good acceptance criteria in your prompt.
Maintain a criteria library. Store successful AI-generated criteria as reference material. This improves future outputs and creates documentation.
Common Pitfalls to Avoid
Generated criteria sometimes miss implicit requirements. Always verify:
-
Error handling scenarios
-
Edge cases (empty input, maximum values, special characters)
-
Performance requirements (if mentioned)
-
Security considerations
-
Accessibility requirements
AI excels at extracting explicit requirements but may miss unstated assumptions. Manual review remains essential.
Related Articles
- AI Tools for Product Managers Converting Customer
- AI Tools for Product Managers Drafting Release
- Best AI Assistant for Product Managers Writing Sprint
- Best AI for Product Managers Creating Stakeholder Update Dec
- Best AI for Product Managers Creating User Persona Documents
Built by theluckystrike — More at zovo.one