---
name: test-plan-from-jira
description: Fetch a Jira story or epic by key and generate a complete QA test plan (scope, scenarios, positive / negative / edge cases with steps and expected results), then export it to a polished PDF and a filable XLSX. Use whenever the user says "create a test plan from <JIRA-KEY>", "write test cases for this story", "turn this ticket into a test plan", or asks to export a test plan to PDF / Excel.
---

# Test Plan from Jira

Turn one Jira issue into a review-ready QA test plan and shareable files.

## Steps
1. Get the Jira key(s) from the user (e.g. `QAJB-42`). If none given, ask for one.
2. Fetch the story:  `python scripts/fetch_jira.py <KEY> > story.json`
   Returns summary, description, acceptance criteria, type, priority, labels.
3. Read `story.json` and design the plan. For each test case include: id, title,
   type (positive/negative/edge/boundary), priority (P1..P3), preconditions,
   numbered steps, expected_result. Derive negative + boundary cases from EVERY
   acceptance criterion; do not just restate the happy path.
4. Write the plan as JSON to `plan.json` (schema below).
5. Export both files:  `python scripts/export.py plan.json`
   -> writes `test-plan-<KEY>.pdf` and `test-plan-<KEY>.xlsx`.
6. Report the file paths + a 3-line summary (scope + case count by type).

## plan.json schema
{
  "key": "QAJB-42",
  "title": "Coupon code at checkout",
  "scope": "Applying, validating, and removing coupon codes at checkout.",
  "out_of_scope": ["Payment gateway", "Inventory"],
  "cases": [
    { "id": "TC-01", "title": "Valid coupon applies discount",
      "type": "positive", "priority": "P1",
      "preconditions": "Cart has 1 eligible item; coupon SAVE10 is active",
      "steps": ["Open checkout", "Enter SAVE10", "Click Apply"],
      "expected_result": "10% discount shown; total updates; success toast" }
  ]
}

## Rules
- Never hard-code the Jira token. fetch_jira.py reads JIRA_* env vars.
- Every acceptance criterion maps to at least one positive AND one negative case.
- Steps atomic + imperative; expected results must be verifiable.
- If the story is thin, list your assumptions at the top of the plan.
