Blog

Lucie Lavičková

Lucie Lavičková

Senior Test Automation Engineer

Test automation framework za jeden den: API testy s Claude Code

19. 11. 2026
Automation API Testing Testing Approaches AI

Before AI became widely available, building a test automation framework took most companies three to six months. At Tesena Fest 2026, we built one with Claude Code in a single day – less than eight hours. We started with an empty repository and finished with 15 API tests written in Playwright and TypeScript, running in GitHub Actions. During the webinar, I explained how we approached the task. The AI agent wrote the code; we defined the plan and rules, and managed the entire process.

At a glance

  • We built an API test automation framework with Claude Code in one day. The roles are clearly defined: the AI agent implements, while a human makes decisions about requirements and approves every change before it is merged.
  • The most important step is planning the architecture before writing the first line of code. Without a plan, the agent generates code that does not meet the actual requirements.
  • Instructions in CLAUDE.md are not enough. Important rules need to be enforced through tools such as linters, Git hooks and branch protection.
  • We validate API tests at three levels: status code, response schema and content. After each data write operation, we retrieve the data again (GET) to verify that it was saved correctly.
  • The frontend may use the API differently from what the documentation describes. A browser network recording (HAR) makes it easy to identify these differences.
  • A skill is useful for tasks you want to monitor and control continuously. An agent is better suited to tasks where you only need the final result, such as triaging a failed pipeline.

What we needed: the initial Claude Code setup

  • A paid Claude plan. Claude Code is not included in the free version. For the full-day workshop, the Claude Pro plan (around CZK 500 per month) was sufficient for participants.
  • VS Code with the Claude Code extension and the Superpowers plugin. We have already shared the installation instructions in our article The AI Revolution in Test Automation: Claude Code and Superpowers.
  • Git and Node.js. We installed Playwright only, without browsers, because we were working exclusively with API tests.
  • GitHub CLI. The agent uses it to interact with GitHub: creating issues and pull requests, reading test results from pipelines and downloading artifacts. GitLab (glab) and most other platforms offer similar command-line tools.
  • An account in the application under test. We tested Todoist using a free account and obtained an API token from it.

Architecture first, code second

Imagine hiring a construction company and simply telling them: 'Build me a house.' They will build you a house, but most likely not the one you had in mind, because they lack context. The same happens when you give an agent a task such as 'Create API tests for Todoist'. We experienced this during a trial run before the workshop. The agent spent two hours generating code, then ran out of tokens. The result was completely different from what we needed.

That is why we start with a brainstorming session. We describe what we need and let the agent ask follow-up questions, just as a construction company would ask how many rooms we need or whether the house should have a garage. The plan should cover:

  • What we are testing and why. The agent does not know our business priorities. Tell it what should not be automated as well, for example, a feature that is about to be completely redesigned next week. AI tends to generate more tests and code than necessary. The question is no longer what we can automate with AI, but what we should prevent it from doing.
  • Information sources. Test cases, API documentation, specifications, known bugs, Confluence pages or transcripts of onboarding meetings. Make sure the input is high-quality and pre-processed, rather than providing tens of gigabytes of raw data.
  • Technology and framework structure. Handling test data and sensitive information (passwords, tokens), as well as post-test cleanup.
  • Test design rules. Naming conventions, tags for grouping tests into suites, and test steps (`test.step`) that make reports understandable even to product owners and analysts.
  • Where, when and how tests run. Environments that can be switched using a single parameter, parallel execution, artifacts and execution frequency.
  • Reporting. Where the results are displayed and who reads them.
  • Boundaries and rules for working with the agent.

During the workshop, we provided this information to Claude in an unstructured way, simply writing down our thoughts as they came to mind. Claude turned them into an architecture plan and highlighted ambiguities, conflicts and gaps. We reviewed and refined the plan before starting framework development. Claude Opus 5.5, together with Superpowers, then broke the work down into smaller tasks and created a GitHub issue for each one.

Setting boundaries for AI agents: instructions are not enough

Just because we tell an agent something in its instructions does not mean it will always follow it. That is why it is worth reinforcing rules with tools:

  • A linter (ESLint for TypeScript) checks types and code issues, while **Prettier** ensures consistent formatting.
  • Git hooks protect the main branch if branch protection cannot be configured directly in GitHub.
  • Every change goes through an issue, a separate branch and a pull request. A human always performs the merge. In our three-person team, we appointed one repository owner who was solely responsible for reviewing and merging changes.
  • Each agent works in its own Git worktree. If you run three agents in parallel in the same repository copy, they will start switching each other's branches, creating chaos. A worktree is a separate working directory linked to the repository, allowing each agent to work in isolation.
  • Once the work is complete, the agent sends you a clickable pull request link. Otherwise, it may only provide a number, leaving you to find the link yourself in GitHub.

One small tip: I have a rule that the agent must write code and documentation in English but communicate with me in Czech. When it starts speaking English, I know it has lost some of the context and is no longer following my instructions.

CLAUDE.md and AGENTS.md

CLAUDE.md is the main instruction file for an agent working in a project. It should contain information the agent cannot deduce on its own: links to documentation, priorities, important architectural decisions, naming conventions and communication style. The file is loaded in every new session, so keep it to around 200 lines. Up to 300 lines is still fine, but a thousand is already a problem.

If someone on your team uses GitHub Copilot or Codex, create an AGENTS.md file containing a single line: `@CLAUDE.md`. This effectively means 'look at CLAUDE.md'. All agents will then follow the same rules.

Be careful with the `.env` file. Claude Code runs on your computer, so to the agent, `.env` is just an ordinary file it can read. It protects secrets from being committed to the repository, not from the agent itself.

GitHub issues and Kanban board

We created an issue for each test case using a template containing the following fields: ID, area, steps, open questions and priority. The instruction to the agent can then be as simple as one sentence, for example: 'Work on issue #13'.

A Kanban board in GitHub Projects provides an overview of who is working on what. GitHub has built-in automations that move tickets across the board automatically.

Rules for contributing to the repository belong in CONTRIBUTING.md, a standard GitHub file. Both humans and agents follow these rules.

The automation process: from smoke tests to E2E scenarios

  1. A smoke test for each main endpoint. This provides a quick overview of whether the backend is working and establishes the foundation of the framework: clients for individual APIs are created.
  2. One feature at a time. For example, a task with a due date, label or comment.
  3. E2E scenarios. From creating a project, through creating a task with a due date, to completing the task and closing the project.
  4. Alternative workflows. Uncompleting a completed task, recurring tasks.
  5. Negative scenarios. Starting with the highest-risk cases and moving towards less likely ones.

Within each step, we prioritise tests based on business risk.

What to watch out for in API testing

  • Three layers of assertions: status code, response schema and content that makes business sense. If the API does not match the documentation, report a bug, whether the issue is in the application or in the documentation.
  • Verify the persisted state: after creating a task, retrieve it again and check its name and due date.
  • Do not guess how things work: if the documentation does not provide an answer, call the API and record the result in the repository. This saves the next agent or colleague from having to investigate the same thing again.
  • Use your own test data with a unique prefix and make sure it is cleaned up even if a test fails.
  • Verify negative scenarios all the way through: if the API returns an error, check that no data was actually created.
  • Keep secrets out of the repository, logs, traces and reports. A custom reporter can help by removing tokens before generating the report.
  • The frontend may not use the API as documented. It may call different endpoints or use a newer API version. We have already encountered a situation where our tests were checking version 6, while both the backend and frontend were using version 7.

Example: creating an E2E test from a HAR recording

We demonstrated this live during the webinar. In the browser DevTools, under the Network tab, we recorded the process of adding a task in Todoist. The documentation describes an endpoint for tasks, but the application actually sent a request to the sync endpoint. We saved the recording as a HAR file in the `temp` folder, which is excluded from Git, and Claude used it to create an E2E test.

One recommendation that came up in the Q&A: use one HAR file per scenario, so the agent does not get confused.

You remain in control: architecture and code review

I also keep track of the evolving architecture by asking Claude to generate infographics of the entire solution. The diagram shows the path of a single test: the test itself, preparation, building blocks (clients, test data and schema validation), integration and the application under test. Below that, it shows the supporting processes: three layers of validation, data cleanup, token protection and automated execution in GitHub.

Framework Architecture for Todoist API Tests with Claude Code and Playwright

The quality of the test code is checked by a pipeline on every pull request: linting, formatting, type checking and unit tests for helper functions. We test our tests, too.

And, most importantly, code review. A test generated from a HAR file created a project that was not part of the recorded scenario. In the past, technical debt accumulated because something was not finished in time. Today, it accumulates because we do not read pull requests and simply merge them.

Skill or agent?

Once you are happy with the result, tell the agent: 'Save everything you have learned as a skill.' A skill is a Markdown file containing a procedure and common mistakes. Based on its description, the agent can recognise when to use it in a future session.

  • Skill = I work with you. A skill is useful while you still want to work iteratively and review every step because you do not fully trust the agent yet.
  • Agent = Do it and report back. An agent is worth using once a skill has worked successfully at least five times and you know the agent can handle that task without your supervision. It works in its own context, independently of you. You can specify which tools it is allowed or not allowed to use, as well as which model it should run.

An example from the webinar: we gave our triage agent only the URL of a failed pipeline. It independently inspected the logs and artifacts and found that the problem was not a test failure, but a brief Todoist outage during data cleanup. It also prepared the text for a bug report.

Frequently asked questions about AI in testing

Do you use MCP servers in the project?

We did not need them for this project. GitHub and Playwright provide command-line tools, and for Jira or Confluence, I call their APIs directly. This is faster and saves tokens.

How can you connect internal Swagger documentation within an organisation?

Claude Code runs on your computer, so it can access anything you can access. Just give it the URL.

Are you not concerned that AI has access to everything on your computer?

It is a risk you need to consciously decide whether to accept. I use paid versions with model training disabled, do not provide sensitive information, and ask the agent to present a plan before any non-trivial action. For sensitive systems, I use a service account with read-only access. There are also specialised tools and AI gateways that filter sensitive information before it is sent to the model provider.

Are all tests written in TypeScript?

Yes, all tests are written in Playwright and TypeScript. However, the same approach can also be applied to Python and other programming languages.

Try the framework yourself

The framework repository on GitHub is public and can be used as a template. Click Use this template, and Claude will guide you through the setup based on README and CONTRIBUTING.md. We intentionally left one issue unimplemented so you can try the process yourself.

This article summarises the webinar held on 29 October 2026. You can watch the full recording on YouTube.

Would you like a similar workshop for your team, using your own application and the tools you already work with? The principles are the same whether you use Claude Code, Copilot or Codex. Find out how we can help with AI in Software Testing and Quality Engineering.

Don't miss out on the latest updates.

Fill in your email address to stay informed about upcoming training sessions, events, and testing know-how.

By submitting this form, you agree to the processing of your personal data in accordance with GDPR and to receiving marketing emails.

Formulář

Don't miss the latest updates

Leave us your email address and receive a regular dose of information about upcoming courses, events, and testing know-how.

By submitting this form, you agree to the processing of your personal data in accordance with GDPR and to receiving marketing emails.