DEV Community

Cover image for How I Automate API Testing Using Claude Code
Emmanuel Mumba
Emmanuel Mumba

Posted on

How I Automate API Testing Using Claude Code

Running API tests manually is frustrating. You dig through folders, hunt for the right test scripts, copy long environment IDs, and hope you’re using the correct access token. One slip, and your test results are meaningless. With Claude Code and Claude Skills, you can skip all that hassle just describe what you want to test in natural language, and the AI handles the rest.

What if you could skip all that? For example:

Instead of manually juggling commands, the AI takes over: it finds the right tests, runs them automatically, and summarizes the results in plain language. You immediately see which endpoints passed, which failed, and why without digging through logs or scripts.

Thanks to Claude Code, Claude Skills, and Apidog CLI, this workflow isn’t just a concept. It’s a practical way to turn tedious API testing into a smooth, conversational process directly from your terminal. Every day, I use it to validate new features, ensure regressions don’t break, and speed up QA just by describing what I want in natural language.

Workflow Overview – How It Works

At its core, this workflow turns your natural-language instructions into fully automated API test runs. Instead of manually hunting for scripts, copying environment IDs, and typing long CLI commands, you just tell Claude what you want.

Here’s the step-by-step flow:

You type a natural-language instruction

For example:

You don’t need to know file paths, CLI flags, or environment IDs. Claude understands your intent from your sentence.

Claude identifies the corresponding test or test suite

Claude scans your configured Skills and test definitions to find exactly which Markdown test file(s) to execute. It determines:

  • Whether it’s a single test or multiple tests.
  • Which environment to run in (dev, test, prod).
  • Any dependencies between tests (optional, depending on setup).

Apidog CLI executes the tests

Once the test files are identified, Claude triggers the Apidog CLI commands behind the scenes. The CLI runs the tests just like you would manually, but without you having to type a single command.

Claude analyzes and summarizes the results

After execution, Claude reads the CLI output, interprets errors or failures, and gives you a human-readable summary. You get answers like:

  • Which API calls succeeded or failed
  • What caused the failure
  • Suggestions for next steps (if configured)

What This Workflow Can Do

Below are several real-world scenarios to illustrate how this workflow can be used in practice.

1. Run a Single Test

Command example:

What’s happening:

  • You tell Claude exactly which test you want to run.
  • Claude identifies the right Markdown test file in your tests/ folder.
  • The test is executed via Apidog CLI.
  • Claude parses the results and summarizes them in plain English.

Why it’s useful:

  • No more hunting for filenames or copying long CLI commands.
  • Fast feedback on a single feature or API endpoint.
  • Reduces mistakes from manual execution.

2. List All Available Tests

Command example:

What’s happening:

  • Claude runs a small script (list-tests.js) that scans your tests/ folder.
  • It extracts the description of each test or test suite.
  • You get a neat list of everything ready to run.

Why it’s useful:

  • Easy to see what tests exist without opening multiple files.
  • Helps new team members understand the test coverage quickly.
  • Makes it easier to decide which tests to run.

3. Run All Tests for a Business Module

Command example:

What’s happening:

  • Claude identifies all tests related to a specific module (e.g., payments).
  • You can run them sequentially (one by one) or in parallel (at the same time).
  • The results are summarized individually or as a batch.

Why it’s useful:

  • Efficient for checking a full workflow or business domain.
  • Saves time when multiple tests need to be run together.
  • Reduces the risk of missing related test cases.

4. Compare Test Results Across Environments

Command example:

What’s happening:

  • Claude runs the same tests in multiple environments (development, staging, production).
  • It analyzes the results and highlights differences.
  • You can see if a bug appears only in one environment or across all.

Why it’s useful:

  • Critical for ensuring consistency across environments.
  • Helps catch environment-specific bugs early.
  • Saves you from manually running the same test multiple times.

Quick Setup

Before diving in, make sure Node.js is installed:

Install Apidog CLI

Verify:

Test by copying a command from Apidog → Tests → CI/CD, adding your access token, and running it. Everything should work.

💡 Tip: Keep both Apidog desktop and CLI updated to use the latest test suite features.

Install Claude Code

Verify:

On first run:

Follow the authorization steps. Once logged in, you’ll have an interactive terminal interface.

At this point, Claude doesn’t yet know how to run API tests that’s where Claude Skills come in.

Building Claude Skills

How Skills Work

A Claude Skill defines how Claude should respond to specific natural-language requests. You don’t select Skills manually just describe what you want, and Claude automatically identifies and executes the correct workflow.

Step 1: Create the Skill Folder

All Skills live under .claude/skills/. Create one for your API tests:

Step 2: Create SKILL.md

Each Skill needs a SKILL.md that tells Claude:

  • When to trigger the Skill
  • How to execute the tests
  • How to interpret the results

Example:

Then define your workflow:

  1. Select test – Use the provided test name or prompt the user if ambiguous.
  2. Batch execution rules – Sequential or parallel, with confirmation.
  3. Confirm environmentdev, test, or prod.
  4. Execute test – Run the Apidog CLI command with environment variables.
  5. Interpret results – Summarize failures and successes.

Step 3: Add Supporting Files

  • env/ – Store environment configs:

Keep these private.

  • scripts/ – Handle execution logic:
  • tests/ – Store test definitions in Markdown:

Claude automatically scans .claude/skills/ and loads your API testing Skill.

Try a command:

Claude will locate the test, run it via Apidog CLI, and summarize the results.

Final Thoughts

Automating API tests with Claude Code and Claude Skills has completely changed my workflow. Tasks that once took minutes or even hours now happen instantly, simply by describing what I want in plain language.

This approach doesn’t just save time it reduces errors, ensures consistent testing, and makes it easier to maintain high-quality APIs. By bridging natural language and the terminal, Claude transforms API testing into a more intuitive and interactive experience.

Summary

  • Manual API testing is tedious natural-language automation simplifies it.
  • Claude Code + Skills + CLI – the AI executes tests and interprets results.
  • Practical use cases – single tests, listing tests, module-wide runs, cross-environment checks, and impacted tests post-code changes.
  • Quick setup – Node.js, Apidog CLI, Claude Code, Skill creation.
  • Benefits – saves time, reduces errors, increases coverage, and encourages more frequent testing.

With this workflow, API testing becomes faster, smarter, and much more developer-friendly.

Top comments (10)

Collapse
 
harutoengineer profile image
Haruto Yamazaki

This looks amazing. How hard is it to set up the Skills?

Collapse
 
therealmrmumba profile image
Emmanuel Mumba

Not too bad! The setup takes a little time, but once it’s done, it saves hours every week.

Collapse
 
juliacli profile image
Julia Thompson

Do I need Apidog specifically, or can this work with other CLI-based test tools?

Collapse
 
therealmrmumba profile image
Emmanuel Mumba

You can adapt the workflow to other CLI tools, but Apidog makes it seamless with the Markdown-based tests.

Collapse
 
tariqdotdev profile image
Tariq Aziz

Setting up Claude Skills seems like a lot of work… I might stick to my old scripts for now.

Collapse
 
aikodev profile image
Aiko Tanaka

Untill your projects start breaking

Collapse
 
sofiatechflow profile image
Sofia Ivanova

Feels overkill for tiny projects, but for mid-size teams, this looks like it could save a lot of headaches.

Collapse
 
therealmrmumba profile image
Emmanuel Mumba

Small projects might not need it, but for anything bigger, the automation pays off quickly

Collapse
 
priyacodes profile image
Priya Mehra

Agreed. My team switched to this workflow last month, and we actually enjoy running tests now.

Collapse
 
danbuilds profile image
Daniel Rios

I love how it integrates CLI commands with AI. Feels modern and smooth.