All AI guides Get started
The Testing Academy · Complete Guide 2026

n8n for QA Engineers

Ten short modules. Five teach n8n basics, five build QA agents for bug triage, RCA, flaky tests, Playwright MCP and CI runs. Each module is the same: we have this, we get this, with one diagram and one workflow to download.

10Modules
10Workflows to download
30QA test scenarios
5QA agents

Learning Path

Part 1 teaches the building blocks. Part 2 uses them to build five QA agents.

01 Data Flow 02 Triggers 03 AI Agent 04 HTTP + APIs 05 Errors 06 Bug Triage 07 RCA 08 Flaky Tests 09 Playwright MCP 10 Run Suite Capstone Connect them
Pink modules need an OpenAI key. Module 09 also needs Playwright MCP running, and 10 needs a GitHub token.

Setup and Import

Use n8n Cloud, or run it locally with one command. Then paste any workflow from this page onto the canvas.

Terminal · Run n8n locally
npx n8n
# or with Docker
docker run -it --rm -p 5678:5678 -v n8n_data:/home/node/.n8n docker.n8n.io/n8nio/n8n
# open http://localhost:5678
Copy a workflowClick Download JSON (or Copy JSON) in any module below, or get all 10 as a zip.
Paste on the canvasOpen a new workflow and press Ctrl+V (Cmd+V on Mac). The nodes appear, already connected.
Run and inspectClick Execute workflow, then open each node. Read INPUT on the left and OUTPUT on the right.

What you need: an OpenAI key for 03 and 06 to 09, Playwright MCP running for 09, and a GitHub token for 10.

01Foundational · Low complexity

Data Flow and Expressions

Everything in n8n is a list of items moving from node to node. Once students can read an item, every other module gets easier.

Theory
What it is:Each node receives items, does its job once per item, and passes new items on. An item is a JSON object.
QA Analogy:Items are rows in a data-driven test. Three rows in means the node runs three times, like a parameterized test.
$json

The current item flowing into this node.

$('Node').item

The matching item from an earlier node, by name.

.first() / .all()

First item, or every item, from that node.

$now

Current date and time (Luxon) for timestamps.

Diagram
StartManual Trigger Sample DataCode node item 1 · Asha item 2 · Ravi item 3 · Meena Expressions DemoSet node · runs ×3 3 items+ issueKey $('Sample Data').first().json.user $json = the current item
Three items go in, so the Set node runs three times. The dashed arrow reads an earlier node by its name.
Code
Expressions · Cheat sheet
{{ $json.chatInput }}                     // current item
{{ $('Sample Data').item.json.user }}     // matching item, earlier node
{{ $('Sample Data').first().json.user }}  // first item only
{{ $json.chatInput.length }}              // plain JavaScript works
{{ ($json.chatInput.toUpperCase().match(/[A-Z][A-Z0-9]+-\d+/) || [''])[0] }}  // VWO-123
{{ $now.toFormat('yyyy-MM-dd HH:mm') }}   // timestamp
Build live
Add a Manual TriggerThe simplest start node. Click it to run the flow.
Add a Code node that returns 3 itemsEach item has user and chatInput. Run it and show 3 items in OUTPUT.
Add Edit Fields (Set)Turn on Include Other Fields. Add issueKey, greeting, processedAt.
Drag a field from INPUTShow how n8n writes the expression for you, then edit it by hand.
🧪 QA Test Scenarios
T01Item count · 3 items into Expressions Demo3 items out
T02Lowercase key · "bug in login, see vwo-45"issueKey = VWO-45
T03No key · "no key in this message"issueKey = "" (no error)
⚠️ Common mistakes
  • Typo in the node name inside $('...')
  • Field set to Fixed instead of Expression (no = prefix)
  • Reading $json when the data came from a different node
01-data-flow-expressions.jsonNo credentialsDownload JSON
View workflow JSON
02Foundational · Low complexity

Triggers and Webhooks

A trigger decides when a workflow runs. For testers, the Webhook is the key one: your CI pipeline calls it after every build.

Theory
What it is:A Webhook gives your workflow a URL. Any tool that can send an HTTP request can start it.
QA Analogy:Like a post-build hook in Jenkins. The build finishes, calls the URL, and n8n decides who to alert.
/webhook-test/...

Test URL. Works only while you click "Listen for test event".

/webhook/...

Production URL. Works only when the workflow is Active.

$json.body

The POST payload. Also $json.query and $json.headers.

0 2 * * *

Cron for the Schedule Trigger: every day at 2 AM.

Diagram
Jenkins / GH Actionsbuild finished POST CI Webhook/build-status Build Failed?body.status == failed true false Respond: Alert Respond: OK JSON response back to CI Nightly Schedulecron 0 2 * * * Nightly Message A second trigger in the same workflow, no HTTP needed
The webhook flow answers CI right away. The schedule flow runs by itself once the workflow is active.
Code
Bash · Simulate a CI call
curl -X POST https://<your-n8n>/webhook-test/build-status \
  -H "Content-Type: application/json" \
  -d '{"build":"#42","branch":"main","status":"failed"}'

# Read it inside n8n
{{ $json.body.status }}    // "failed"
{{ $json.body.build }}     // "#42"
Build live
Add a Webhook nodeMethod POST, path build-status, Respond: Using 'Respond to Webhook' Node.
Click Listen for test eventRun the curl. Show the payload under body.
Add IF and two Respond nodesCheck {{ $json.body.status }} equals failed. Each branch returns its own JSON.
Add a Schedule TriggerCron 0 2 * * *. Explain it fires only after you activate the workflow.
🧪 QA Test Scenarios
T01Failed build · status = failedalert: true
T02Passed build · status = passedalert: false
T03No Content-Type header · body not parsedgoes to OK (a bug to discuss)
⚠️ Common mistakes
  • Calling the production URL while the workflow is inactive
  • Missing Content-Type: application/json
  • Reading $json.status instead of $json.body.status
02-triggers-webhooks.jsonNo credentialsDownload JSON
View workflow JSON
03AI · High complexity

AI Agent with Tools

An agent is a chat model that can remember the conversation and call tools. This is the module students will use most at work.

Theory
What it is:Agent = Model (brain) + Memory (history) + Tools (hands). The model reads the message and decides which tool to call.
QA Analogy:A junior tester with a checklist. The system message is the checklist; tools are the apps they are allowed to open.
chatInput

What the user typed. Comes from the Chat Trigger.

sessionId

Keeps each user's memory separate.

$fromAI()

Lets the AI fill a tool parameter, like a username or a Jira key.

Tool description

The agent picks tools by reading this. Vague text means wrong picks.

Diagram
Chat Trigger"18% of 4999?" chatInputsessionId AI Agentsystem message + prompt answer Chat reply"899.82" modelmemorytools OpenAI Chat Modelthinks and decides Simple Memorylast 10 messages Calculatormath github_lookup$fromAI('username')
The agent sits in the middle. Green tools are the ones it can call; the model decides when.
Code
Expressions · Agent and tools
// AI Agent prompt (Define below)
{{ $json.chatInput }}

// HTTP Request tool URL: the AI fills the username
https://api.github.com/users/{{ $fromAI('username', 'GitHub username to look up', 'string') }}

// Jira tool: the AI pulls the key out of "create a ticket for VWO-123"
{{ $fromAI('issueKey', 'Jira key like VWO-123', 'string') }}
Build live
Add Chat Trigger and AI AgentOpen Chat and send "hi". Show chatInput and sessionId in the trigger output.
Attach OpenAI Chat ModelAdd the credential. Write a short system message.
Attach Simple MemoryAsk "what was my first question?" before and after adding it.
Attach two toolsCalculator, then an HTTP Request tool with $fromAI() in the URL. Open the logs to see each tool call.
🧪 QA Test Scenarios
T01Tool choice · "What is 18% of 4999?"Calculator called
T02$fromAI value · "Look up the GitHub user torvalds"username = torvalds
T03Memory · "What was my first question?"answers from history
⚠️ Common mistakes
  • Vague tool descriptions, so the agent never calls the tool
  • No system message, so answers drift
  • A node between trigger and agent, and memory loses sessionId
03-ai-agent-tools.jsonNeeds OpenAI credentialDownload JSON
View workflow JSON
04Integration · Medium complexity

HTTP Request and API Testing

The HTTP Request node reaches any API, even ones without a native node. Add an IF node and it becomes an API test.

Theory
What it is:Send GET, POST, PUT, PATCH or DELETE with headers, query and body. Use one response's data in the next request.
QA Analogy:Postman plus assertions, but chained and scheduled. IF nodes play the role of expect().
Full Response

Turn on to get statusCode, headers and body.

Import cURL

Paste a curl command and n8n fills the node.

Credentials

Use saved credentials or Header Auth. Never hardcode tokens.

Pagination

Built-in option for APIs that return pages.

Diagram
GET Post/posts/1 body.id POST Create/posts Assert201 AND title ok PASS FAIL Full Response ON statusCode201 headers{ ... } body{ id: 101 }
The GET result feeds the POST body. The IF node checks two things, just like two assertions in one test.
Code
Expressions · Chained body and assertions
// POST body (JSON) built from the GET response
{{ JSON.stringify({
  title: 'Created from n8n',
  body: 'Copied from post ' + $json.body.id,
  userId: $json.body.userId
}) }}

// IF node assertions
{{ $json.statusCode }}   equals  201
{{ $json.body.title }}   equals  Created from n8n
Build live
GET with Full Response onCall jsonplaceholder.typicode.com/posts/1. Show statusCode, headers, body.
POST using GET dataBody type JSON, built with JSON.stringify so quotes never break it.
Add the IF assertionsTwo conditions with AND: status 201 and the title matches.
Break it on purposeChange the expected title and watch it go to FAIL.
🧪 QA Test Scenarios
T01Happy path · POST valid body201 → PASS
T02Wrong expectation · expected title changed→ FAIL branch
T03Missing resource · GET /posts/9999404 stops flow (see 05)
⚠️ Common mistakes
  • Full Response off, then asking "where is statusCode?"
  • Hand-written JSON body that breaks on a quote
  • API tokens pasted into the URL or headers instead of credentials
04-http-request-apis.jsonNo credentialsDownload JSON
View workflow JSON
05Reliability · Medium complexity

Branching, Error Handling and Debugging

Real APIs fail. This module makes workflows retry, take a safe path when something breaks, and alert the team.

Theory
What it is:IF and Switch route items. Node settings add retries and an error output. An Error Trigger workflow catches anything left over.
QA Analogy:Happy path, negative path and recovery. Every branch is a test case you must run at least once.
Retry On Fail

Max Tries and Wait Between Tries, for flaky APIs.

On Error

Stop, Continue, or Continue using error output.

Error Trigger

Its own workflow. Set it as the Error Workflow in Settings.

Pin Data

Freeze a node's output to replay the same input while debugging.

Diagram
Sample InputVWO-123 · 500 Has Key?IF issueKey not empty false Missing Key true Call APIhttpbin /status/500 retry ×2 · wait 1s success error output API OK Handled Error separate Error Workflow Error Trigger Alert Team Fires when any linked workflow fails unhandled
Three outcomes from one input: success, handled error, or missing data. The Error Trigger is the safety net.
Code
Settings · Call API node
Retry On Fail ........ ON
Max Tries ............ 2
Wait Between Tries ... 1000 ms
On Error ............. Continue (using error output)

// In the error branch
{{ $json.error.message }}

// In the Error Trigger workflow
{{ $json.workflow.name }}  {{ $json.execution.lastNodeExecuted }}
Build live
Set input and extract the keyReuse the regex from Module 01. Add an IF for a missing key.
Call a failing APIhttpbin.org/status/500. Run it and let it fail first.
Add retries and error outputSettings tab of the node. Run again and show two tries in the log.
Pin data and debugPin Sample Input, open Executions, use Debug in Editor on a failed run.
🧪 QA Test Scenarios
T01API healthy · statusToSimulate = 200→ API OK
T02API down · statusToSimulate = 5002 tries → Handled Error
T03No key · chatInput without VWO-123→ Missing Key, no API call
⚠️ Common mistakes
  • No negative path, so bad input crashes the flow
  • "Continue" chosen with nothing handling the error, so failures go silent
  • Never opening Executions to see what actually happened
05-branching-errors-debugging.jsonNo credentialsDownload JSON
View workflow JSON
06-10Part 2 · QA Agents

QA Agents

Five agents, one demo app. Each one is simple: we have this, we get this.

ModuleWe haveWe get
06 Bug Triage3 failed testscategory, severity, duplicate, owner
07 RCA1 failed testroot cause, suspect commit, fix
08 Flaky Tests10 CI runs of 5 testsa verdict per test, a fix per flaky test
09 Playwright MCPa chat messagea real browser run, PASS or FAIL
10 Run Suitea GitHub repothe run result and its link

Demo app: TTACart. Users standard_user, locked_out_user, error_user, performance_glitch_user. Password tta_secret.

06QA Agent · Medium complexity

Bug Triage Agent

Give it failed tests. Get back a triage decision for each one, with duplicates checked.

We have, we get
We have:3 failed TTACart tests: the test name and the error.
We get:category severity duplicateOf owner summary for each test.
Diagram
3 failed testsTTACart suite Triage Agentrules in system message duplicate? search_open_bugs Parse ResultJSON → fields first failure product_bug · P2 dup: CART-101 owner: Ravi
We have 3 failures, we get a decision for each. The tool checks open bugs so the same bug is not filed twice.
Prompt
System message · Triage Agent
1. Call search_open_bugs with key words from the failure.
2. category: product_bug, test_bug, flaky or environment. Passed on retry = flaky.
3. severity: P1 login or checkout down, P2 wrong result in a main flow,
   P3 intermittent or minor, P4 test code only.
4. If an open bug matches, use its key and owner.

Reply with JSON only:
{"test":"","category":"","severity":"","duplicateOf":"","owner":"","summary":""}
Build live
Failed Tests (Code)Return 3 failures as items: test and error.
Triage Agent + search_open_bugsPaste the system message. The Code Tool is a fake Jira search, so no Jira setup is needed.
Parse ResultTurns the agent's JSON text into fields. Run it and read the 3 results.
🧪 QA Test Scenarios
T01Wrong total · checkout order totalproduct_bug · P2 · CART-101
T02Passed on retry · error_user add to cartflaky · P3 · CART-102
T03Short timeout · performance_glitch_user logintest_bug · P4 · no duplicate
06-bug-triage-agent.jsonNeeds OpenAI credentialDownload JSON
View workflow JSON
07QA Agent · High complexity

RCA Agent

Give it a failed test. Get back the root cause, plus the commit and the log line that prove it.

We have, we get
We have:1 failed test. The order total is $39.98 instead of $43.18.
We get:rootCause evidence suspectCommit confidence fix
Diagram
1 failed test$39.98, not $43.18 RCA Agentevidence first get_recent_commits get_app_logs Parse ResultJSON → fields we get commit 9f2c1ab confidence: high fix: set ENABLE_TAX_V2
The agent has to read commits and logs before it answers, so every claim comes with evidence.
Prompt
System message · RCA Agent
1. Always call get_recent_commits and get_app_logs first.
2. Every claim needs evidence: a commit sha or a log line.
3. Weak evidence = confidence "low". Do not guess.

Reply with JSON only:
{"rootCause":"","evidence":[""],"suspectCommit":"","confidence":"high|medium|low","fix":""}
Build live
Failed Test (Set)Three fields: test, error, failedAt.
RCA Agent + 2 Code ToolsSample commits and logs. Later, swap them for the GitHub API and your log tool.
Parse Result, then open the logsShow both tool calls in the agent's logs, then the answer.
🧪 QA Test Scenarios
T01Evidence first · run onceboth tools called
T02Right commit · tax failure9f2c1ab · high
T03Weak evidence · delete the WARN log lineconfidence drops
07-rca-agent.jsonNeeds OpenAI credentialDownload JSON
View workflow JSON
08QA Agent · Medium complexity

Flaky Test Detector

Give it CI history. Get back which tests are flaky, which are broken, and a fix for each flaky one.

We have, we get
We have:The last 10 CI runs of 5 TTACart tests, each a pass or a fail.
We get:A verdict per test (stable watch flaky broken) and a Playwright fix for each flaky one.
Diagram
last 10 CI runs, oldest → newest checkout total broken error_user add flaky cart remove flaky glitch login watch standard login stable Keep Flakyverdict = flaky Suggest FixAI, 1 per test 2 tests, 1 fix each pass fail
Code does the math. A test that keeps flipping is flaky. A test that stays red is broken: that is a real bug, so don't retry it.
Code
Rule · Score Flakiness
flips      = how often the result changes between runs
flakyScore = flips / (runs - 1)

stable  → never failed
flaky   → flakyScore ≥ 0.3          // keeps flipping
broken  → last 3 runs all failed    // real bug, do not retry
watch   → failed once, keep an eye on it
Build live
CI History (Code)5 tests, 10 runs each.
Score Flakiness (Code)Do the math in code, not in AI. Run it and read the 5 verdicts.
Keep Flaky → Suggest FixA Filter, then a Basic LLM Chain that writes one fix per flaky test.
🧪 QA Test Scenarios
T01Keeps flipping · error_user add, cart removeflaky · 0.67, 0.44
T02Red 4 runs in a row · checkout totalbroken, not flaky
T03One failure · glitch loginwatch
08-flaky-test-detector.jsonNeeds OpenAI credentialDownload JSON
View workflow JSON
09QA Agent · High complexity

Playwright MCP Agent

Type a test in chat. The agent runs it in a real browser and tells you PASS or FAIL.

We have, we get
We have:A chat message, for example "log in as locked_out_user and tell me the error".
We get:RESULT: PASS or FAIL with the exact text the agent saw on the page.
Diagram
Chat"log in as locked_out_user" Browser Test Agentsnapshot, then act tools Playwright MCP:8931/mcp ChromiumTTACart RESULT: PASS or FAIL + evidence
The agent clicks through a real browser. This is for quick checks driven from chat, not for running a regression suite (that is Module 10).
Setup
Terminal + MCP Client Tool
# 1. Start Playwright MCP and keep this terminal open
npx @playwright/mcp@latest --port 8931

# 2. MCP Client Tool settings in n8n
Endpoint:  http://localhost:8931/mcp
Transport: HTTP Streamable

# n8n in Docker: use http://host.docker.internal:8931/mcp
# and start MCP with --host 0.0.0.0 --allowed-hosts "*"
# n8n Cloud cannot reach localhost: run n8n locally for this module
Build live
Start Playwright MCPOne command, port 8931.
Chat Trigger + Agent + MCP Client ToolSet Max Iterations to 30. The system message names the app and the test users.
Chat and watchRun T01 to T03. A browser opens and the agent clicks through.
🧪 QA Test Scenarios
T01Happy login · log in as standard_userPASS · "Products"
T02Locked user · log in as locked_out_user"Sorry, this user has been locked out."
T03Cart · add backpack and bike lightbadge shows 2
09-playwright-mcp-agent.jsonNeeds OpenAI + Playwright MCPDownload JSON
View workflow JSON
10CI · Medium complexity

Run a Playwright Suite from n8n

Click Execute workflow. n8n starts your Playwright suite in GitHub Actions and brings back the result.

We have, we get
We have:A GitHub repo with Playwright tests and the workflow file below.
We get:conclusion (success or failure) and the url of the run.
Diagram
Run Configowner, repo Run SuitePOST dispatch Wait 30s Get RunGET runs Done? Resultsuccess + link not yet: wait again (max 20) starts GitHub Actions: playwright test status
One loop does the waiting: check every 30 seconds, stop when the run is complete or after 20 checks.
YAML
YAML · .github/workflows/playwright.yml
name: playwright
on:
  workflow_dispatch:
    inputs:
      grep:
        description: Run only tests matching this text
        default: ''
jobs:
  test:
    runs-on: ubuntu-latest
    steps:
      - uses: actions/checkout@v4
      - uses: actions/setup-node@v4
        with:
          node-version: 20
      - run: npm ci
      - run: npx playwright install --with-deps chromium
      - run: npx playwright test --grep "${{ inputs.grep }}"
Build live
Add the YAML and a tokenA fine-grained GitHub token with Actions read and write on the repo.
Run Config → Run SuitePOST to /dispatches returns 204. Set grep to run one test case.
Wait → Get Run → Done?Loops every 30 seconds until the run is complete, at most 20 times.
🧪 QA Test Scenarios
T01Green suite · all tests passconclusion: success
T02One test case · grep = checkoutonly checkout tests run
T03Red suite · one test failsconclusion: failure + link
10-run-playwright-suite.jsonNeeds GitHub credentialDownload JSON
View workflow JSON

Quick Reference

The nodes used in this course and when to reach for each.

Manual TriggerRun by hand while building01
CodeCustom JavaScript, sample data01 · 06 · 07 · 08
Edit Fields (Set)Add or change fields01 · 05 · 07 · 10
WebhookStart from CI or any HTTP call02
Respond to WebhookSend a custom reply to the caller02
Schedule TriggerNightly or hourly jobs (cron)02
Chat TriggerChat window for agents03 · 09
AI AgentModel + memory + tools03 · 06 · 07 · 09
Code ToolYour JavaScript as an agent tool06 · 07
MCP Client ToolUse an MCP server's tools09
Basic LLM ChainOne AI call, no tools08
HTTP RequestAny REST API, API tests04 · 05 · 10
IFTwo paths, assertions02 · 04 · 05 · 10
SwitchMany paths, e.g. 2xx / 4xx / 5xx05
FilterKeep only matching items08
WaitPause, then check again10
Error TriggerAlert when a workflow fails05
★Uses all ten modules

Capstone: Connect the Agents

Students wire the agents into one pipeline. Every step is a module they have already built.

StepWhat happensModule
1Run the Playwright suite from n8n10
2Send each failure to the triage agent06
3Run RCA on P1 and P2 product bugs07
4Score flakiness nightly and quarantine flaky tests08
5Smoke check from chat before a release09
6Retries and an Error Workflow keep it running05