{
  "name": "Jira AI Test Case Generator",
  "nodes": [
    {
      "parameters": {
        "public": true,
        "initialMessages": "Hi there! \ud83d\udc4b\nMy name is Abdulrhman. How can I assist you today?",
        "options": {}
      },
      "type": "@n8n/n8n-nodes-langchain.chatTrigger",
      "typeVersion": 1.4,
      "position": [
        -1184,
        -224
      ],
      "id": "96abbcc5-b525-476b-9463-74561e0875cd",
      "name": "When chat message received"
    },
    {
      "parameters": {
        "promptType": "define",
        "text": "=Analyze the provided Jira user story and generate comprehensive manual test cases.\n\nStory Key:\n{{ $json.storyKey }}\n\nSummary:\n{{ $json.summary }}\n\nDescription:\n{{ $json.description }}",
        "options": {
          "systemMessage": "You are a Senior QA Engineer specialized in manual testing.\n\nAnalyze the provided Jira user story and perform a comprehensive QA analysis before generating manual test cases.\n\nAnalyze all available information including:\n- User Story\n- Description\n- Acceptance Criteria\n- Business Rules\n- Preconditions\n- Field Validations\n- UI Requirements\n- Error Messages\n- Edge Cases\n\nIdentify all possible test scenarios based on:\n- Functional behavior\n- Acceptance Criteria\n- Business Rules\n- Validations\n- User inputs\n- System responses\n- Error handling\n- Edge Cases\n- State transitions\n- Data variations\n- Security considerations (when applicable)\n\nGenerate manual test cases for every identified scenario required to achieve complete functional coverage.\n\nEnsure coverage includes:\n- Happy Path\n- Alternate Flows\n- Negative Scenarios\n- Validations\n- Business Rules\n- Error Handling\n- Edge Cases\n- State Transitions\n- Boundary Conditions (when applicable)\n\nGenerate at least one unique manual test case for every identified test scenario.\n\nFor each test case:\n\n- title\n  Write a clear verification statement starting with \"Verify\".\n  This will be used as the Jira Subtask Summary.\n\n  Example:\n  Verify that a registered user can log in successfully using a valid email address or phone number and the correct password.\n\n- description\n  Write ONLY a short scenario name.\n  Examples:\n  - Successful login with valid email or phone and password\n  - Empty email\n  - Empty password\n  - Invalid email format\n  - Wrong password\n  - Locked account\n  - Disabled account\n\n- steps\n  Return an ordered array of detailed manual execution steps.\n  Prefix every step with its number (for example: \"1. Open the login page\", \"2. Enter a valid email address\", \"3. Click Login\"). This formatting is required for better rendering in Jira.\n\n- expectedResult\n  Describe the expected system behavior after executing the steps.\n  If the expected result contains multiple outcomes, format them as a numbered list (for example: \"1. User is authenticated.\\n2. Home page is displayed.\\n3. User profile is loaded.\"). If there is only one outcome, prefix it with \"1.\".\n\nRules:\n\n- Preserve the original storyKey.\n- Generate only unique test cases.\n- Do not invent requirements that do not exist.\n- Do not return duplicate scenarios.\n- Never leave any field empty.\n- Do not return markdown.\n- Do not wrap the response in code blocks.\n- Return ONLY valid JSON.\n\nReturn exactly this schema:\n\n{\n  \"storyKey\": \"\",\n  \"testCases\": [\n    {\n      \"title\": \"\",\n      \"description\": \"\",\n      \"steps\": [],\n      \"expectedResult\": \"\"\n    }\n  ]\n}"
        }
      },
      "type": "@n8n/n8n-nodes-langchain.agent",
      "typeVersion": 3.1,
      "position": [
        -272,
        -224
      ],
      "id": "c2cfe24f-c9e8-432d-a6d1-915e9b298369",
      "name": "AI Agent"
    },
    {
      "parameters": {
        "modelName": "models/gemini-3.5-flash",
        "options": {}
      },
      "type": "@n8n/n8n-nodes-langchain.lmChatGoogleGemini",
      "typeVersion": 1.1,
      "position": [
        -480,
        0
      ],
      "id": "7a913fb9-9d21-4184-9fff-68298d144eba",
      "name": "Google Gemini Chat Model",
      "credentials": {}
    },
    {
      "parameters": {
        "model": "=llama3.1:8b",
        "options": {}
      },
      "type": "@n8n/n8n-nodes-langchain.lmChatOllama",
      "typeVersion": 1,
      "position": [
        -272,
        16
      ],
      "id": "d4a02c21-cdd4-4685-b9a7-76c2acea00bc",
      "name": "Ollama Chat Model",
      "credentials": {}
    },
    {
      "parameters": {
        "fieldToSplitOut": "testCases",
        "options": {}
      },
      "type": "n8n-nodes-base.splitOut",
      "typeVersion": 1,
      "position": [
        240,
        -192
      ],
      "id": "a6bbc7d6-3d65-4660-81c0-978cc8d6fce6",
      "name": "Split Out"
    },
    {
      "parameters": {
        "project": {
          "__rl": true,
          "value": "<PROJECT_ID>",
          "mode": "list",
          "cachedResultName": ""
        },
        "issueType": {
          "__rl": true,
          "value": "<ISSUE_TYPE_ID>",
          "mode": "list",
          "cachedResultName": ""
        },
        "summary": "={{ $json.title }}",
        "additionalFields": {
          "assignee": {},
          "description": "=h2. Description\n\n{{$json.description}}\n\nh2. Steps\n\n{{ $json.steps.join('\\n') }}\n\nh2. Expected Result\n\n{{$json.expectedResult}}",
          "parentIssueKey": "={{ $('Get an issue').first().json.key }}",
          "reporter": {}
        }
      },
      "type": "n8n-nodes-base.jira",
      "typeVersion": 1,
      "position": [
        464,
        -176
      ],
      "id": "637fd855-fd75-49bc-9dfa-c94f28f76d91",
      "name": "Create an issue",
      "credentials": {}
    },
    {
      "parameters": {
        "assignments": {
          "assignments": [
            {
              "id": "a3d0a9ed-c9a1-492b-b4c6-8eeb7fbeabcd",
              "name": "=storyKey",
              "value": "={{\nJSON.parse(\n  $json.output.match(/\\{[\\s\\S]*\\}/)[0]\n).storyKey\n}}",
              "type": "string"
            },
            {
              "id": "a34d7729-de18-4c29-9090-c47f206e10c4",
              "name": "testCases",
              "value": "={{\nJSON.parse(\n  $json.output.match(/\\{[\\s\\S]*\\}/)[0]\n).testCases\n}}",
              "type": "array"
            }
          ]
        },
        "options": {}
      },
      "type": "n8n-nodes-base.set",
      "typeVersion": 3.4,
      "position": [
        48,
        -176
      ],
      "id": "fde2beee-859a-420f-b84d-d3704e286907",
      "name": "testCases"
    },
    {
      "parameters": {},
      "type": "@n8n/n8n-nodes-langchain.memoryBufferWindow",
      "typeVersion": 1.4,
      "position": [
        -64,
        80
      ],
      "id": "4f9e64e9-30ae-45d7-b3ca-c4902bcc7252",
      "name": "Simple Memory"
    },
    {
      "parameters": {
        "operation": "get",
        "issueKey": "={{$json.issueKey}}",
        "additionalFields": {}
      },
      "type": "n8n-nodes-base.jira",
      "typeVersion": 1,
      "position": [
        -768,
        -224
      ],
      "id": "41b28944-f016-4843-90cf-c0922b40089f",
      "name": "Get an issue",
      "credentials": {}
    },
    {
      "parameters": {
        "assignments": {
          "assignments": [
            {
              "id": "b170f265-bb60-4fea-8897-39054cd776f5",
              "name": "storyKey",
              "value": "={{$json.key}}",
              "type": "string"
            },
            {
              "id": "c6a20eb3-707c-44f8-bab0-0a3d45c34c66",
              "name": "summary",
              "value": "={{$json.fields.summary}}",
              "type": "string"
            },
            {
              "id": "6a10e2f9-936f-40f0-9e71-168cb25e6068",
              "name": "description",
              "value": "={{$json.fields.description}}",
              "type": "string"
            }
          ]
        },
        "options": {}
      },
      "type": "n8n-nodes-base.set",
      "typeVersion": 3.4,
      "position": [
        -528,
        -208
      ],
      "id": "888ed569-53e9-4131-947f-e6f081957794",
      "name": "Set Story Context"
    },
    {
      "parameters": {
        "assignments": {
          "assignments": [
            {
              "id": "3bcf857c-36ee-4d97-800a-4bf66d041a68",
              "name": "issueKey",
              "value": "={{\n($json.chatInput.match(/[A-Z]+-\\d+/) || [])[0]\n}}",
              "type": "string"
            }
          ]
        },
        "options": {}
      },
      "type": "n8n-nodes-base.set",
      "typeVersion": 3.4,
      "position": [
        -992,
        -112
      ],
      "id": "2fe72467-6c52-41b4-8cb2-546beeb41dde",
      "name": "Set Issue Key"
    }
  ],
  "connections": {
    "When chat message received": {
      "main": [
        [
          {
            "node": "Set Issue Key",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Google Gemini Chat Model": {
      "ai_languageModel": [
        [
          {
            "node": "AI Agent",
            "type": "ai_languageModel",
            "index": 0
          }
        ]
      ]
    },
    "Ollama Chat Model": {
      "ai_languageModel": [
        []
      ]
    },
    "AI Agent": {
      "main": [
        [
          {
            "node": "testCases",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Split Out": {
      "main": [
        [
          {
            "node": "Create an issue",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "testCases": {
      "main": [
        [
          {
            "node": "Split Out",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Simple Memory": {
      "ai_memory": [
        [
          {
            "node": "AI Agent",
            "type": "ai_memory",
            "index": 0
          }
        ]
      ]
    },
    "Set Story Context": {
      "main": [
        [
          {
            "node": "AI Agent",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Get an issue": {
      "main": [
        [
          {
            "node": "Set Story Context",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Set Issue Key": {
      "main": [
        [
          {
            "node": "Get an issue",
            "type": "main",
            "index": 0
          }
        ]
      ]
    }
  },
  "active": true,
  "settings": {
    "executionOrder": "v1",
    "binaryMode": "separate",
    "availableInMCP": false
  },
  "versionId": "7a1ae2b4-e5f7-44f6-b2e8-262c68e238f0",
  "meta": {
    "templateCredsSetupCompleted": true
  },
  "nodeGroups": [],
  "id": "U197wOyrA7gUjC9V",
  "tags": []
}