Test Case Generator
Generate structured, comprehensive test cases from any input — and export them as a
formatted, ready-to-use Excel (.xlsx) file compatible with Excel and Google Sheets.
Input Types Supported
- User Stories — "As a user, I want to..."
- Feature Descriptions — Plain English description of a feature
- Acceptance Criteria — Bullet points or Gherkin-style Given/When/Then
- API Endpoints — Method, URL, request/response details
- Bug Fixes — Regression test cases from a bug description
- Rough Notes — Even messy, informal input is fine
Workflow
Step 1 — Understand the Input
Read the input carefully and identify:
- What is being tested (feature, API, UI flow, business rule)
- Who is the actor (end user, admin, system, API consumer)
- What are the success and failure conditions
- What data or state is involved
If the input is ambiguous, make reasonable assumptions and state them clearly before generating.
Step 2 — Identify Test Categories
Always cover these categories (skip only if clearly not applicable):
| Category |
Description |
| Positive |
Valid inputs, expected flow works correctly |
| Negative |
Invalid inputs, rejected requests, error states |
| Boundary |
Min/max values, empty, null, zero, max length |
| Security |
Auth checks, unauthorized access, injection attempts |
| UI/UX |
Responsive, disabled states, loading states (if applicable) |
| Regression |
Existing functionality should not break |
Step 3 — Generate & Export to Excel
Use Python + openpyxl to produce a formatted .xlsx file with 3 sheets:
Sheet 1 — Test Cases: TC ID | Title | Category | Preconditions | Test Steps | Expected Result | Status (blank) | Priority
Sheet 2 — Test Data: Suggested valid, invalid, and boundary values per field
Sheet 3 — Summary: Feature name, date, total count, breakdown by category and priority
Formatting Rules
- Header row: Bold white text on dark blue (#1F4E79), frozen
- Category column: color-coded fills per category
- Positive → #E2EFDA (green), Negative → #FCE4D6 (red), Boundary → #FFF2CC (yellow)
- Security → #E8D5F5 (purple), UI/UX → #DEEAF1 (blue), Regression → #FFF2CC (yellow)
- Priority column: High → #F4CCCC, Medium → #FCE5CD, Low → #D9EAD3
- Status column: light grey (#EEEEEE), left blank for testers
- Font: Arial 10pt; wrap text on Test Steps and Expected Result columns
- Row height: 50px for data rows; column widths auto-fit (Test Steps = 55, Expected = 40)
- Thin borders on all cells
- Sheet tab colors: blue (Test Cases), green (Test Data), grey (Summary)
Step 4 — Save & Present
- Filename:
test-cases-<feature-name>.xlsx (kebab-case)
- Copy to
/mnt/user-data/outputs/
- Use
present_files tool to deliver to user
- Print a brief chat summary: total TCs generated, categories covered
Python Code Template
from openpyxl import Workbook
from openpyxl.styles import Font, PatternFill, Alignment, Border, Side
from openpyxl.utils import get_column_letter
from datetime import date
wb = Workbook()
# Sheet 1: Test Cases
ws = wb.active
ws.title = "Test Cases"
ws.sheet_properties.tabColor = "1F4E79"
HEADERS = ["TC ID","Title","Category","Preconditions","Test Steps","Expected Result","Status","Priority"]
HEADER_FILL = PatternFill("solid", fgColor="1F4E79")
HEADER_FONT = Font(bold=True, color="FFFFFF", name="Arial", size=10)
DATA_FONT = Font(name="Arial", size=10)
THIN = Side(style="thin")
BORDER = Border(left=THIN, right=THIN, top=THIN, bottom=THIN)
CAT_FILLS = {
"Positive": "E2EFDA", "Negative": "FCE4D6", "Boundary": "FFF2CC",
"Security": "E8D5F5", "UI/UX": "DEEAF1", "Regression": "FFF2CC",
}
PRI_FILLS = {"High": "F4CCCC", "Medium": "FCE5CD", "Low": "D9EAD3"}
for col, h in enumerate(HEADERS, 1):
c = ws.cell(row=1, column=col, value=h)
c.font, c.fill, c.border = HEADER_FONT, HEADER_FILL, BORDER
c.alignment = Alignment(horizontal="center", vertical="center", wrap_text=True)
ws.freeze_panes = "A2"
ws.row_dimensions[1].height = 30
# --- Replace test_cases with actual generated data ---
test_cases = [
# (tc_id, title, category, preconditions, steps, expected, priority)
]
for r, (tc_id, title, cat, pre, steps, exp, pri) in enumerate(test_cases, 2):
row = [tc_id, title, cat, pre, steps, exp, "", pri]
ws.row_dimensions[r].height = 50
for col, val in enumerate(row, 1):
c = ws.cell(row=r, column=col, value=val)
c.font, c.border = DATA_FONT, BORDER
c.alignment = Alignment(vertical="top", wrap_text=True)
if col == 3 and cat in CAT_FILLS:
c.fill = PatternFill("solid", fgColor=CAT_FILLS[cat])
elif col == 7:
c.fill = PatternFill("solid", fgColor="EEEEEE")
c.alignment = Alignment(horizontal="center", vertical="top")
elif col == 8 and pri in PRI_FILLS:
c.fill = PatternFill("solid", fgColor=PRI_FILLS[pri])
c.alignment = Alignment(horizontal="center", vertical="top")
for i, w in enumerate([10,30,14,28,55,40,12,10], 1):
ws.column_dimensions[get_column_letter(i)].width = w
# Sheet 2: Test Data
ws2 = wb.create_sheet("Test Data")
ws2.sheet_properties.tabColor = "70AD47"
for col, h in enumerate(["Field / Parameter","Valid Values","Invalid Values","Boundary Values","Notes"], 1):
c = ws2.cell(row=1, column=col, value=h)
c.font, c.fill, c.border = HEADER_FONT, HEADER_FILL, BORDER
c.alignment = Alignment(horizontal="center", vertical="center")
ws2.freeze_panes = "A2"
# Add test data rows here
# Sheet 3: Summary
ws3 = wb.create_sheet("Summary")
ws3.sheet_properties.tabColor = "808080"
from collections import Counter
cat_counts = Counter(tc[2] for tc in test_cases)
pri_counts = Counter(tc[6] for tc in test_cases)
summary_rows = [
("Feature / Module", "<feature name>"),
("Date Generated", str(date.today())),
("Total Test Cases", len(test_cases)),
("", ""),
("By Category", "Count"),
] + [(k, v) for k, v in cat_counts.items()] + [
("", ""),
("By Priority", "Count"),
] + [(k, v) for k, v in pri_counts.items()] + [
("", ""),
("Note", "Fill 'Status' column with: Pass / Fail / Blocked / N/A"),
]
for r, (label, val) in enumerate(summary_rows, 1):
ws3.cell(row=r, column=1, value=label).font = Font(bold=True, name="Arial", size=10)
ws3.cell(row=r, column=2, value=val).font = Font(name="Arial", size=10)
ws3.column_dimensions["A"].width = 22
ws3.column_dimensions["B"].width = 35
wb.save("test-cases-feature.xlsx")
Priority Guide
- High — Core functionality; product is unusable without this
- Medium — Important but a workaround exists
- Low — Edge case, cosmetic, or nice-to-have
Tips for Best Results
- More context = better coverage. Share acceptance criteria or system constraints if available.
- Mention the tech stack if relevant (REST API, mobile app, web form, etc.).
- Ask for a specific category if needed — e.g. "only security test cases".
- Multiple features? Mention all — each gets its own labelled section in the sheet.
1---2name: test-case-generator3description: Generates comprehensive, structured test cases from feature descriptions, user stories, requirements, or acceptance criteria — and exports them as a formatted Excel (.xlsx) file ready for use in Excel or Google Sheets. Use this skill whenever the user mentions: "write test cases", "generate test cases", "create test scenarios", "test coverage", "QA testing", "test a feature", "test this requirement", "positive/negative test cases", "edge cases", "boundary value testing", or shares a user story / requirement and wants it tested. Also trigger when user says "I need to test X" or pastes a Jira story, BRD, or PRD excerpt expecting test output. Always use this skill for test case creation — even if the request seems simple, a structured Excel output is almost always more useful.4---56# Test Case Generator78Generate structured, comprehensive test cases from any input — and export them as a9formatted, ready-to-use **Excel (.xlsx)** file compatible with Excel and Google Sheets.1011---1213## Input Types Supported1415- **User Stories** — "As a user, I want to..."16- **Feature Descriptions** — Plain English description of a feature17- **Acceptance Criteria** — Bullet points or Gherkin-style Given/When/Then18- **API Endpoints** — Method, URL, request/response details19- **Bug Fixes** — Regression test cases from a bug description20- **Rough Notes** — Even messy, informal input is fine2122---2324## Workflow2526### Step 1 — Understand the Input27Read the input carefully and identify:28- **What** is being tested (feature, API, UI flow, business rule)29- **Who** is the actor (end user, admin, system, API consumer)30- **What** are the success and failure conditions31- **What** data or state is involved3233If the input is ambiguous, make reasonable assumptions and state them clearly before generating.3435### Step 2 — Identify Test Categories36Always cover these categories (skip only if clearly not applicable):3738| Category | Description |39|---|---|40| Positive | Valid inputs, expected flow works correctly |41| Negative | Invalid inputs, rejected requests, error states |42| Boundary | Min/max values, empty, null, zero, max length |43| Security | Auth checks, unauthorized access, injection attempts |44| UI/UX | Responsive, disabled states, loading states (if applicable) |45| Regression | Existing functionality should not break |4647### Step 3 — Generate & Export to Excel4849Use Python + openpyxl to produce a formatted .xlsx file with 3 sheets:5051**Sheet 1 — Test Cases**: TC ID | Title | Category | Preconditions | Test Steps | Expected Result | Status (blank) | Priority5253**Sheet 2 — Test Data**: Suggested valid, invalid, and boundary values per field5455**Sheet 3 — Summary**: Feature name, date, total count, breakdown by category and priority5657#### Formatting Rules58- Header row: Bold white text on dark blue (#1F4E79), frozen59- Category column: color-coded fills per category60 - Positive → #E2EFDA (green), Negative → #FCE4D6 (red), Boundary → #FFF2CC (yellow)61 - Security → #E8D5F5 (purple), UI/UX → #DEEAF1 (blue), Regression → #FFF2CC (yellow)62- Priority column: High → #F4CCCC, Medium → #FCE5CD, Low → #D9EAD363- Status column: light grey (#EEEEEE), left blank for testers64- Font: Arial 10pt; wrap text on Test Steps and Expected Result columns65- Row height: 50px for data rows; column widths auto-fit (Test Steps = 55, Expected = 40)66- Thin borders on all cells67- Sheet tab colors: blue (Test Cases), green (Test Data), grey (Summary)6869### Step 4 — Save & Present70- Filename: `test-cases-<feature-name>.xlsx` (kebab-case)71- Copy to `/mnt/user-data/outputs/`72- Use `present_files` tool to deliver to user73- Print a brief chat summary: total TCs generated, categories covered7475---7677## Python Code Template7879```python80from openpyxl import Workbook81from openpyxl.styles import Font, PatternFill, Alignment, Border, Side82from openpyxl.utils import get_column_letter83from datetime import date8485wb = Workbook()8687# Sheet 1: Test Cases88ws = wb.active89ws.title = "Test Cases"90ws.sheet_properties.tabColor = "1F4E79"9192HEADERS = ["TC ID","Title","Category","Preconditions","Test Steps","Expected Result","Status","Priority"]93HEADER_FILL = PatternFill("solid", fgColor="1F4E79")94HEADER_FONT = Font(bold=True, color="FFFFFF", name="Arial", size=10)95DATA_FONT = Font(name="Arial", size=10)96THIN = Side(style="thin")97BORDER = Border(left=THIN, right=THIN, top=THIN, bottom=THIN)9899CAT_FILLS = {100 "Positive": "E2EFDA", "Negative": "FCE4D6", "Boundary": "FFF2CC",101 "Security": "E8D5F5", "UI/UX": "DEEAF1", "Regression": "FFF2CC",102}103PRI_FILLS = {"High": "F4CCCC", "Medium": "FCE5CD", "Low": "D9EAD3"}104105for col, h in enumerate(HEADERS, 1):106 c = ws.cell(row=1, column=col, value=h)107 c.font, c.fill, c.border = HEADER_FONT, HEADER_FILL, BORDER108 c.alignment = Alignment(horizontal="center", vertical="center", wrap_text=True)109ws.freeze_panes = "A2"110ws.row_dimensions[1].height = 30111112# --- Replace test_cases with actual generated data ---113test_cases = [114 # (tc_id, title, category, preconditions, steps, expected, priority)115]116117for r, (tc_id, title, cat, pre, steps, exp, pri) in enumerate(test_cases, 2):118 row = [tc_id, title, cat, pre, steps, exp, "", pri]119 ws.row_dimensions[r].height = 50120 for col, val in enumerate(row, 1):121 c = ws.cell(row=r, column=col, value=val)122 c.font, c.border = DATA_FONT, BORDER123 c.alignment = Alignment(vertical="top", wrap_text=True)124 if col == 3 and cat in CAT_FILLS:125 c.fill = PatternFill("solid", fgColor=CAT_FILLS[cat])126 elif col == 7:127 c.fill = PatternFill("solid", fgColor="EEEEEE")128 c.alignment = Alignment(horizontal="center", vertical="top")129 elif col == 8 and pri in PRI_FILLS:130 c.fill = PatternFill("solid", fgColor=PRI_FILLS[pri])131 c.alignment = Alignment(horizontal="center", vertical="top")132133for i, w in enumerate([10,30,14,28,55,40,12,10], 1):134 ws.column_dimensions[get_column_letter(i)].width = w135136# Sheet 2: Test Data137ws2 = wb.create_sheet("Test Data")138ws2.sheet_properties.tabColor = "70AD47"139for col, h in enumerate(["Field / Parameter","Valid Values","Invalid Values","Boundary Values","Notes"], 1):140 c = ws2.cell(row=1, column=col, value=h)141 c.font, c.fill, c.border = HEADER_FONT, HEADER_FILL, BORDER142 c.alignment = Alignment(horizontal="center", vertical="center")143ws2.freeze_panes = "A2"144# Add test data rows here145146# Sheet 3: Summary147ws3 = wb.create_sheet("Summary")148ws3.sheet_properties.tabColor = "808080"149from collections import Counter150cat_counts = Counter(tc[2] for tc in test_cases)151pri_counts = Counter(tc[6] for tc in test_cases)152153summary_rows = [154 ("Feature / Module", "<feature name>"),155 ("Date Generated", str(date.today())),156 ("Total Test Cases", len(test_cases)),157 ("", ""),158 ("By Category", "Count"),159] + [(k, v) for k, v in cat_counts.items()] + [160 ("", ""),161 ("By Priority", "Count"),162] + [(k, v) for k, v in pri_counts.items()] + [163 ("", ""),164 ("Note", "Fill 'Status' column with: Pass / Fail / Blocked / N/A"),165]166for r, (label, val) in enumerate(summary_rows, 1):167 ws3.cell(row=r, column=1, value=label).font = Font(bold=True, name="Arial", size=10)168 ws3.cell(row=r, column=2, value=val).font = Font(name="Arial", size=10)169ws3.column_dimensions["A"].width = 22170ws3.column_dimensions["B"].width = 35171172wb.save("test-cases-feature.xlsx")173```174175---176177## Priority Guide178179- **High** — Core functionality; product is unusable without this180- **Medium** — Important but a workaround exists181- **Low** — Edge case, cosmetic, or nice-to-have182183---184185## Tips for Best Results186187- More context = better coverage. Share acceptance criteria or system constraints if available.188- Mention the tech stack if relevant (REST API, mobile app, web form, etc.).189- Ask for a specific category if needed — e.g. "only security test cases".190- Multiple features? Mention all — each gets its own labelled section in the sheet.