Dev48
Language
  • About
  • Services
  • Industries
  • Technologies
  • Articles
  • Contacts
Book a call
    Home/Articles/Boxing in the llm rest assured to postman with claude code
Dev48
info@dev48.org+375 29 320-40-96WhatsApp@isky_by

© 2026 · All rights reserved.

Boxing in the LLM: REST Assured to Postman with Claude Code

Фото: Sylwester Walczak (Unsplash) — https://unsplash.com/photos/a-pair-of-brown-shoes-XFhaYR1kbCc?utm_source=dev48&utm_medium=referral

Source: Postman Blog•December 2, 2026 at 04:02 PM

Boxing in the LLM: REST Assured to Postman with Claude Code

Migrate REST Assured tests to Postman with Claude Code and the Postman plugin. A for loop runs boxed-in workers, and the Postman CLI checks the output. The post Boxing in the LLM: REST Assured to Postman with Claude Code appeared first on Postman Blog .

December 2, 2026

Migrating a mature Java API test suite into Postman sounds like a job for an LLM until you try it. A single REST Assured project can carry hundreds of @Test methods across dozens of classes, a BaseTest that sets the base URI in a @BeforeSuite, parameterized data providers, a few WireMock stubs, and a TestNG suite XML that quietly decides which classes run. Hand all of it to a model in one prompt and you get creative fiction. Hand it one class at a time, inside boring deterministic scaffolding, and you get correctness.

That’s the architecture we landed on when we built Postman’s REST Assured converter, and it carries over to a workflow you can run on your own machine. In this post you’ll convert a REST Assured project to a Postman Collection with Claude Code and the Postman plugin. A shell for loop decides what to convert and how many pieces there are. A boxed-in worker converts one test class at a time. The plugin’s skills supply the collection file format, run the result, and gate it in CI. The most reliable agent in the system is the for loop.

Box in the model

Every decision downstream flows from one choice: what counts as a unit of work the model is allowed to reason about? We picked one Java test class. A method is too little context, because data providers and helper methods live at the class level. A whole project is too much, and the model starts inventing cross-class references. Once you commit to that boundary, the rest of the design follows:

In the production converter, the scheduling is p-map with a concurrency of 6, each unit gets three attempts, and the whole pipeline has a 30-minute timeout. A unit that fails all three attempts lands in a failed list and the run keeps going. There is no coordinator agent: no orchestrator LLM watching the run, no planner picking the next unit. The agent is a function that the loop calls, so the LLM lives at the leaves of the call tree, not the root.

What you need

  • Claude Code with the claude command on your path
  • The Postman CLI (the plugin’s cli-install skill can install it if it’s missing)
  • jq and a Unix shell
  • A REST Assured project with JUnit 5 or TestNG tests

Install the Postman plugin

One command installs the plugin into each supported agent it detects, including Claude Code:

The plugin gives Claude skills for API engineering. Each skill holds instructions the agent reads for a task. This workflow touches four of them: collection-schema-v3 for the collection file format, api-testing for running assertions, api-mocking for stubs, and ci-integration for the pull request gate. Linting and running a collection locally don’t require you to sign in to Postman. You only need to sign in when you publish to a workspace.

Step 1: Discover test classes with grep

Before any model runs, a discovery pass walks the project with plain tools. The marker count it records becomes the coverage target for each class. Create scripts/discover.sh:

On the demo project, which has a BaseTest plus UsersTest and PostsTest, the output looks like this:

BaseTest has no test markers, so it isn’t a unit. It’s context the workers will read. Over-inclusion is fine at this stage. A class with no HTTP calls comes back with an empty list, while a class that never got enumerated is a bug you may not notice for months.

Most REST Assured projects build a shared RequestSpecBuilder in a base class. If every worker rediscovered it independently, you’d get a different guess at the variable name from each one. So a single resolver call runs first, with a prompt that is aggressively narrow. Save it as prompts/resolver.md:

Then call it from scripts/resolve.sh. The --allowedTools flag is the box: this call can read files and nothing else. Redirecting stdin from /dev/null keeps claude -p from waiting on a pipe.

The last jq -e line is a deterministic check on a probabilistic step. If the model returns anything other than the shape you asked for, the script stops. On the demo project, the resolver returns this:

The worker never has to guess what to name baseUrl, because it was told.

Step 3: Convert one class at a time with a for loop

The worker prompt is explicit about its boundary. It converts exactly one class, it can’t write files, and it has to return JSON. Save it as prompts/worker.md:

This is where the model earns its keep. It maps the REST Assured fluent DSL and Hamcrest matchers onto pm.expect chains, which is a translation problem a model handles well. The prompt names the collection-schema-v3 skill so the worker gets the exact file shape instead of recalling it. In a streamed run of the demo, the worker reads the class, calls the skill, and reads the skill’s files before it answers.

Now the loop itself, scripts/convert.sh. It reads units.tsv, gives each class three attempts, checks that the request count meets the marker count, and only then writes files:

Run it:

On the demo project, each class converts on the first attempt:

Your turn counts and costs depend on your model and your project. The shape of the result matters more: the model never touched the file system. It returned JSON, and the loop validated it, counted it, and placed each file. A prompt-injected comment in a test file can’t make the worker write anything or run anything, because the worker has no tool that does either.

What the worker wrote

Here’s UsersTest.getUserById next to the request file the worker returned for it:

The base URI is now the {{baseUrl}} collection variable, the Hamcrest matchers are pm.expect chains, and the test names are readable. Query parameters came through too. PostsTest.getPostsByUser has a userId parameter, and the worker recorded it in both the URL and the queryParams list, which is what the v3 format requires.

Step 4: Lint and run the collection

The converter’s job ends when files exist. The Postman CLI decides whether they’re any good. Lint checks structure:

Then run the collection, which is the api-testing skill’s core move: reuse the saved requests and assertions as regression checks.

Five requests ran and all 12 assertions passed. Lint and a green run are two different guarantees. Lint says Postman can read the files. A run says the converted checks hold against the API. Neither says the converted checks match the original intent, so compare the counts. The demo’s Java tests contain 15 REST Assured checks, and they became 12 pm.test blocks, because the worker grouped the four field checks in getUserById into one test. That’s a reasonable choice, and it’s also the kind of thing to skim before you trust a migration.

Handle WireMock stubs with api-mocking

A project with WireMock stubs has a second kind of unit, and the demo scripts above don’t cover it. In the production converter, a class with no test markers but real stubFor blocks routes to a mock-specific prompt. You can add the same branch to this loop with a second marker pattern in discover.sh and a second worker prompt. Each stub becomes a request with a saved response example in the *.example.yaml format the collection-schema-v3 skill documents. From there the api-mocking skill takes over. postman mock generate builds a mock from a collection’s documented responses, and postman mock run serves it locally without a sign-in. A suite that needed a local WireMock process can point at that mock instead.

One caveat from the skill’s own guidance: a generated mock replays documented responses. A POST and a later GET share no state, so put the error cases your callers handle, such as the unknown-ID 404, into the examples. Read the mock command reference before you rely on a mock for behavior it can’t model.

Gate the collection in CI

Once the converted tests pass locally, the ci-integration skill’s job is to make a pull request carry them. Pick one gate per guarantee so a failed build tells you whether structure or behavior broke. This workflow lints first, then runs:

The demo collection calls a public API, so it runs as is. For a real suite, point the job at a mock or a staging environment you’re willing to write to, because a collection run sends real requests. A local-only gate like this one needs no API key. Add postman login with a secret from your CI store when you want run results published to a workspace. See Run the Postman CLI in GitHub Actions for the details.

Things to watch for

  • Coverage is a count, not a guarantee. The marker count catches “the model got bored and stopped.” It can’t catch a request that exists but asserts the wrong thing.
  • Check failed-units.txt after every run. A failed class is named there. The collection is smaller than the project it came from but still valid, so the failure is hard to notice if you only look at the green run.
  • Treat the model’s output as untrusted input. Validate the JSON shape with jq, sanitize file names, and write files from the loop, never from the worker.
  • Keep the shell away from the worker. The read-only tool list is what makes the loop safe to point at a large codebase.
  • Don’t drop classes because a TestNG suite file omits them. Suite files go stale in real projects, so use them to report orphan classes only.

The generalizable idea

The REST Assured specifics don’t matter as much as the questions behind them. What is the smallest unit of work the model can reason about correctly on its own? Which parts of the problem are deterministic enough that code can own them outright? Where does the model earn its keep, and where are you paying token cost for a regex?

The answers reshape the architecture. Discovery becomes a regex pass. Shared configuration becomes a one-shot call. Fan-out becomes a for loop. Assembly becomes code that writes files. What’s left in the middle is a small, boxed-in agent doing a translation it’s good at.

The most useful thing we did was stop trying to make the agent smarter and start making the code around it dumber. The for loop doesn’t have opinions about REST Assured, doesn’t misremember which classes it already converted, and doesn’t run out of context. It keeps calling the worker until the units are gone.

Try it yourself

Copy the three scripts and two prompts from this post into the root of your Maven or Gradle project, then work through it in this order:

  • Run npx @postman/postman-plugin to install the plugin.
  • Run ./scripts/discover.sh and check that units.tsv lists the classes you expect.
  • Run ./scripts/resolve.sh and read resolved.json. If the variable name or base URI is wrong, fix the prompt before you convert anything.
  • Trim units.tsv to one or two classes and run ./scripts/convert.sh.
  • Run postman collection lint and postman collection run on the output, then compare the REST Assured check count with the pm.test count.
  • Restore the full units.tsv, run the loop again, and open failed-units.txt.

Then change one thing and watch what happens. Add a data provider to a test and see whether the worker writes one request per row. Remove Skill from --allowedTools and compare the generated files. Add a class with no HTTP calls and confirm it returns an empty list.

Resources

  • Postman plugin skills
  • Install the Postman plugin
  • Postman plugin on GitHub
  • Collection commands in the Postman CLI
  • Mock commands in the Postman CLI
  • Run the Postman CLI in GitHub Actions
  • Run Claude Code programmatically
  • REST Assured
  • WireMock stubbing
← All articles

What this article says

More in Software Development

All →
HIPAA-Compliant Software Development: An Architecture Checklist
Artezio

HIPAA-Compliant Software Development: An Architecture Checklist

10 Ecommerce Holiday Shopping Strategies For Mom and Pop Shops
Salesforce

10 Ecommerce Holiday Shopping Strategies For Mom and Pop Shops

Pools, spas, and cabanas are now bookable on Airbnb with ResortPass
Airbnb

Pools, spas, and cabanas are now bookable on Airbnb with ResortPass

deepset | Sovereign AI in production: deepset CEO Milos Rusic in Materna MONITOR
deepset

deepset | Sovereign AI in production: deepset CEO Milos Rusic in Materna MONITOR

deepset | deepset joins govdigital's framework contract for AI development
deepset

deepset | deepset joins govdigital's framework contract for AI development

What Are Enterprises Actually Paying For When the Model Is Nearly Free?
DataArt

What Are Enterprises Actually Paying For When the Model Is Nearly Free?

More from Postman

A Developer’s Guide to Building and Testing AI Agents with Astropods and the Postman Plugin
Postman

A Developer’s Guide to Building and Testing AI Agents with Astropods and the Postman Plugin

GitHub and CI/CD Security at Postman
Postman

GitHub and CI/CD Security at Postman

Benchmarking Coding Agents on Real API Integration Tasks
Postman

Benchmarking Coding Agents on Real API Integration Tasks

Agentic SDLC Part 3: Verify Behavior, Keep the Evidence
Postman

Agentic SDLC Part 3: Verify Behavior, Keep the Evidence

Agentic SDLC Part 1: Design with the Context Graph
Postman

Agentic SDLC Part 1: Design with the Context Graph

Your coding agent leaked the key. It was only following orders.
Postman

Your coding agent leaked the key. It was only following orders.