QA with your own agent
Keep test cases by feature, let your agent draft them from the acceptance criteria and run them in a real browser, then read a result with a screenshot for every step.
Requirements
- A workspace in which you are an owner or editor. Viewers read test cases and results but cannot change them.
- An agent connected to the PugBase MCP server with an API key that can write. A read-only key reads test cases but cannot save them or send results. Connect an agent
- Node.js and a browser on the machine the agent runs on. The agent writes a Playwright test script for each test case and runs it there, and installs Playwright itself the first time. The Playwright MCP server lets it look at the page while it writes; for Claude Code, add it with the command below.
claude mcp add playwright npx @playwright/mcp@latest
- The system under test opens from the machine the agent runs on.
The terminal screenshots in this guide are from Claude Code. PugBase has no Run button: the two buttons in the QA menu copy a prompt, and your agent does the work.
Create a feature
Open QA in the workspace's sidebar and press + Feature. A feature holds one set of test cases: a page, a flow or a ticket.
The feature opens empty, with a place for acceptance criteria and a place for test cases.
Your agent can create the feature as well. Ask it to write test cases for a feature that is not in the list yet: it works out the acceptance criteria from what you tell it and from the code and documents of your project, then saves the feature, the criteria and the test cases together. Those test cases are marked To review.
Add acceptance criteria
Press + AC and type the criteria, or paste the whole list from Jira or a document. Numbered lists, bullets, labels such as AC1: and Given/When/Then blocks are split into separate criteria.
Each criterion gets an ID (AC-1, AC-2, ...) and keeps it when its text is edited. The feature page shows the result of each criterion and the ones no test case covers yet. A criterion passes only when every test case under it passes.
This step is optional. A feature works with test cases alone.
Add test cases
Press + Test case. Name it, state the precondition and test data, tick the criteria it proves and write the steps: one action and its expected result per step. Pasting several lines creates one step per line.
Where words are not enough, press the image button on a step and attach a reference image, such as the approved design. The agent opens the image when it runs that step and compares the screen with it.
Every step has its own ID. A test case has a version that goes up when its steps or precondition change, and a result always belongs to the version it was run against.
For test cases that already exist in a spreadsheet, press Import Excel, choose the file, check the preview and confirm. The accepted layout is described under Excel format below.
Let your agent draft the rest
Press Prompt to draft beside the acceptance criteria. The prompt is copied to the clipboard.
Paste it into your agent and add what the agent cannot know: the URL of the system and which accounts it may use.
The agent reads the criteria and the existing test cases, then saves new ones for the criteria that have none. It only adds: existing test cases are never changed, and a case with a name that already exists is skipped.
Drafts are marked To review on the feature page.
Open each draft, correct what is wrong and press Reviewed. Saving a correction also clears the mark.
Run with your agent
Press Prompt to run at the top of the feature page and paste it into your agent.
The agent reads the test cases. For each one it takes the script stored with the case, or writes a Playwright test script from the steps when there is none, and runs it on your machine in a real browser. It takes a screenshot of every step (up to three when one cannot show everything), marks where the evidence is in each, uploads them and sends the result of each case to PugBase together with the script and what the runner printed. A case stops at its first failing step.
The agent reports what it saw. PugBase decides the result from the steps and from the script, as described under How a result is decided.
Read the results
The QA menu lists every feature with its counts. The feature page shows the result of each criterion, the count by result and the last five runs of every test case.
Open a test case to read its run step by step: the result, the agent's note and the screenshot. A failed step shows what was expected and what was found. When the step has a reference image, it is shown beside the screenshot. Click a screenshot to open it large beside what the step expected and what the agent found, with the evidence boxed in red, and use the arrows to move through the steps. Below the steps is the script behind the run: what PugBase found in it, the lines that differ from the script stored with the case, and what the runner printed.
Fix and run again
After the fix, paste the run prompt again and add the sentence below. The agent runs only the test cases whose latest result is not a pass, including the ones never run and the ones changed since their last run. A test case that has a stored script is run with that script, unchanged, by whoever runs it next.
Run only the test cases that have not passed.
When the test case itself was wrong, correct it in the QA menu. Its version goes up, the earlier result is shown as a result of the older version, and the next run is recorded against the new one.
How a result is decided
The agent sends a pass or fail, a note and its screenshots for each step, with the position of the evidence in each screenshot, and the script it ran. PugBase draws that position as a red box, reads the script, and works out the result of the test case from what was sent:
- Passed: every step passed, every step has its own screenshot with the evidence marked, and the script behind the run holds up.
- Failed: at least one step failed. The page names the step.
- Unverified: no step failed, but a step has no result, no screenshot, or a screenshot with no evidence marked, or the script was not sent or did not hold up. The case does not count as passed.
- Not run: no result yet.
A result sent for a test case that was changed after the agent read it is refused. The agent reads the case again and runs the current version.
PugBase reads the script of every run sent as passed, and never runs it. Fixed rules come first: every step of the case is in the script with a check on the screen and a screenshot, and the script does not change the page, fake what the system returns, call the API directly or skip a check. The script is then compared with the steps and acceptance criteria of the case. A check on a different value than the step expects, a check that was removed and a check that cannot fail each make the run Unverified, and the reply tells the agent what to correct. A script that holds up is stored with the case and handed to the next agent.
Excel format
- The file is .xlsx or .csv. The header row must be within the first 15 rows.
- It needs a column for the steps (Steps, Action, Test Procedure) and a column for the name or the ID of the test case (Title, Test Case, Scenario, ID). Expected Result and Precondition columns are read when present. Thai column names are read as well.
- Both layouts work: one row per step, or all steps of a test case numbered inside one cell (1. ... 2. ...).
- The first sheet that holds test cases is used. Images in the file are not imported; attach a reference image to the step afterwards.
Limits
- A test case holds up to 40 steps. A feature holds up to 60 acceptance criteria.
- One import adds up to 200 test cases. One call from an agent adds up to 50.
- The feature page shows the last five runs of each test case.
- The comparison of a script with a test case is made by an AI model and can be wrong in either direction. PugBase reads the script the agent sends and cannot confirm that the agent ran exactly that script, so the screenshots with their marked evidence remain the record of what was on screen.
Common problems
- The agent has no list_test_cases tool: it is not connected to the PugBase MCP server with an API key. The PugBase connector in the Claude and ChatGPT directories does not include the QA tools.
- The agent cannot save test cases or send results: its API key is read-only, or the key's owner is a viewer of the workspace. Create a key that can write in Settings > Developer.
- A result is Unverified: a step came without a result, without a screenshot or with a screenshot that marks no evidence, or the script did not hold up. Open the test case to read what is missing, then ask the agent to run that test case again.
- The agent asks for the URL before it starts: write the URL in Precondition and test data of the test case, or add it to the prompt.
- The pages need a sign-in: give the agent a test account in your own prompt. A test case is visible to every member of the workspace, so do not write a password in it.
- The agent cannot run the script: Node.js is not installed on its machine, or the agent is not allowed to run commands. Install Node.js and allow the agent to run npx.