Automated Testing
of REST APIs

For humans, for agents

Coding agent

Use RESTest to test the REST APIs you develop in this project. Follow the setup and usage instructions at https://isa-group.github.io/restest-site/docs/for-coding-agents/

Paste it into your favourite coding agent: the agent installs RESTest and runs it for you.

Homebrew

brew install isa-group/tap/restest

On macOS and Linux. It installs the Java RESTest runs on, too.

jbang

jbang app install restest@https://isa-group.github.io/jbang-catalog/jbang-catalog.json

On macOS, Linux and Windows. It downloads a Java when there is none.

Docker

docker run --rm -v "$PWD:/work" ghcr.io/isa-group/restest:2.5.0 version

Nothing to install but Docker. The manual says how to use it as a command.

01 · How it works

From an API schema to the faults, with nothing to configure.

Give RESTest an OpenAPI document and the address of the API it describes. It makes up requests, checks every reply against what the document promised, and reports each fault with a curl command that sends the request again.

  1. It reads the document. OpenAPI 2.0, 3.0 or 3.1. It never looks at the API's code, so the API can be written in any language and run anywhere.
  2. It makes up requests and sends them for as long as you allow: a minute by default.
  3. It checks every reply against what the document promised, and says what to fix for each kind of fault.
Spring PetClinic REST · 1 min
OpenAPI43 operationsrestest runa minuteAPIa black boxGETPOSTGETPUTDELETE
  1. errorInternal server error (F100)
    POST /api/owners → 500
    The API answered 500, so it fell over while handling this request
  2. errorInvalid data accepted (F206)
    POST /api/users → 201
    The API accepted a request it should have refused: sent 0.5 for body.username, declared as a word
  3. warningUndeclared status code (F920)
    GET / → 302
    The API answered 302, which the document does not declare for this operation; it declares 200
  4. warningUndeclared content type (F921)
    PUT /api/visits/{visitId} → 404
    The API answered 404 as application/problem+json, which the document does not declare for that status; it declares application/json
  5. warningReply off schema (F200)
    GET /api/pets → 200
    The body does not match the shape the specification declares for it, answering 200 as application/json
182,898requests sent
26,973errors, on 30 of 43 operations
71,237warnings, on 39 of 43 operations
02 · The report

Detailed results at a glance.

A run writes report.html beside report.json: one file that opens in any browser, with no network, in light and dark.

Summary and timeline

The top of report.html for the run: four cards counting the replies by class of status code, the errors and the warnings by kind, and the operations by what was found on them, then the timeline of the runThe top of report.html for the run: four cards counting the replies by class of status code, the errors and the warnings by kind, and the operations by what was found on them, then the timeline of the run

A fault, in full

An operation opened in report.html: how its replies divided, a button for each kind of fault found on it, and the first fault of the first kind written out whole, the request beside the replyAn operation opened in report.html: how its replies divided, a button for each kind of fault found on it, and the first fault of the first kind written out whole, the request beside the reply

What was found

What was found in report.html: each kind of fault, errors first, with what to look at, the classes of status code it came back in, and on how many operationsWhat was found in report.html: each kind of fault, errors first, with what to look at, the classes of status code it came back in, and on how many operations

A real run: Spring PetClinic REST, as the Web Fuzzing Dataset builds it, tested for a minute by RESTest 2.4.0.

03 · On real APIs

52 APIs, a minute each.

The APIs of the Web Fuzzing Dataset, each started on its own and tested by RESTest 2.5.0. Every row of the showcase opens that run's report.

See the showcase
2,962,868requests
350,335errors
1,346,268warnings
50 of 52APIs with an error
Most errorsRequestsErrorsWarnings
pay-publicapi78,24077,52277,814
swagger-petstore152,37661,7338,919
erc20-rest-service61,75955,6715,680
person-controller37,17020,24227,622
features-service30,17817,3992,066
04 · For coding agents

Your coding agent tests as it builds.

Ask your coding agent to use RESTest while it develops your API: RESTest finds the bugs as they appear, and the agent fixes them before they reach you.

RESTest and coding agents
YouUse RESTest to test the REST APIs you develop in this project. Follow the setup and usage instructions at https://isa-group.github.io/restest-site/docs/for-coding-agents/
  1. It installs or updates RESTest, with Homebrew, jbang, the image or the archive, whichever fits.
  2. It makes a quick first pass, a run of one minute, and tells you in a few lines what it found.
  3. It fixes what was found, when developing the API is its task, and checks each fix by sending the request again.
  4. It offers a deeper pass, with a dictionary of values it writes from the API's document, code and data.
05 · Shaping a run

Fit a run to your API. Three inputs, each optional.

A run needs nothing but the document. Each of these makes it fit your API better, and has a chapter of the manual.

--campaignA plan

How a run builds its requests, where their values come from, and which operations it may touch.

--dictionaryDictionaries

Values you know are good: identifiers that exist, names the API holds. A coding agent can write them from the API's document and code.

--setSettings

How the tool itself behaves: how many requests at once, how long to wait for a reply, and switches that each turn off one thing a run does.

06 · About us

Do you need help? Contact us.

RESTest is developed by the SCORE Research Lab at the University of Seville (Spain). If you would like to try it on your organisation's APIs and need help, let us know, we will be glad to help.