Documentation

API Testing & Test Suites

Go beyond manual testing into repeatable, automated API testing with contract validation, variable chaining, and scheduled runs.

01

Getting Started

The Test Suite feature lets you group HTTP requests into named suites, define assertions on each response, and run them all with a single click. It is available as a Pro feature.

To open the Test Suite window:

  1. Open any OpenAPI specification in SuagerUI.
  2. Click the Test Suite button in the document header bar (next to Mock Server and Export).
  3. The API Testing window opens pre-loaded with your spec, so you can add endpoints directly from it.
02

Creating Test Suites

A Test Suite is a named group of test cases that run sequentially. You can create as many suites as you need β€” for example, one per feature area, one for smoke tests, one for full regression.

  1. Click the + button in the suite list sidebar.
  2. A new suite named β€œNew Test Suite” is created.
  3. Click the suite name in the detail header to rename it.

To delete a suite, right-click it in the sidebar and choose Delete.

πŸ’‘

Each suite has its own variables, test cases, and configurable delay between requests (default: 0.5s).

03

Adding Test Cases

There are three ways to add test cases to a suite:

Manual

Click Add Test in the test case list header. This creates a blank test case where you configure the method, path, base URL, headers, body, and authentication manually.

From your spec (single endpoint)

When a spec is loaded, the Batch Add menu lets you pick individual tags. All endpoints within that tag are added with pre-filled method, path, base URL, and a default status code assertion.

Batch add all endpoints

Choose Add all endpoints at the bottom of the Batch Add menu to add every endpoint in your spec at once. Each gets contract testing enabled by default.

πŸ’‘

Each test case can be individually enabled or disabled with the toggle switch. Disabled tests are skipped during execution.

04

Assertions

Assertions define what you expect from the API response. If any enabled assertion fails, the test case is marked as failed.

TypeFieldExpectedExample
Status Code(not used)HTTP status codeExpected: "200"
Header ContainsHeader nameSubstring to findField: "Content-Type", Expected: "json"
Body Contains(not used)Substring in bodyExpected: "success"
JSON PathDot-path to valueExpected valueField: "data.id", Expected: "42"

When you add a test case from the spec, a status code assertion is automatically added based on the first response defined in the spec.

05

Variables & Scoping

Variables let you parameterize your test cases. Use the {{variableName}} syntax in any field: path, base URL, headers, body, query parameters, and authentication values.

Variables follow a hierarchical override system with three scopes:

ScopeWhere to defineVisibility
GlobalVariables tab β†’ Global VariablesAll suites and all test cases
SuiteVariables tab β†’ Suite VariablesAll test cases within the suite
RequestOn the test case itselfOnly that specific test case

When the same variable name exists at multiple scopes, the narrower scope wins: Request > Suite > Global.

Base URL: {{baseUrl}}
Path:     /users/{{userId}}
Header:   Authorization: Bearer {{token}}
06

Request Chaining

Request chaining lets you extract values from one response and use them in subsequent test cases. This is essential for flows like:

  1. POST /users β†’ extract id from the response
  2. GET /users/{{userId}} β†’ use the extracted ID
  3. DELETE /users/{{userId}} β†’ clean up

Setting up extraction

Each test case has an extractAfter configuration where you define:

  • Variable name β€” the name to store the extracted value under (e.g., userId)
  • JSON path β€” a dot-separated path to the value in the response body (e.g., data.id)

Extracted values are available as {{variableName}} in all subsequent test cases within the same run.

07

Contract Testing

Contract testing validates that the live API response matches what your OpenAPI spec promises. When enabled on a test case, SuagerUI checks:

  • The response status code is defined in the spec
  • The response body JSON types match the schema (string, integer, number, boolean, array, object)
  • Object structure matches the defined properties

Contract violations are shown separately from assertion failures, marked with a purple badge. A test case fails if it has any contract violation or assertion failure.

πŸ’‘

Test cases added from the spec have contract testing enabled by default. You can toggle it per test case.

08

Running Tests

Click the green Run All button in the suite detail header to start execution. Tests run sequentially with the configured delay between requests.

During execution you will see:

  • A progress bar showing the current test number
  • Live pass/fail counts updating in real time
  • Each completed test appearing with its status, HTTP code, and duration

Click Cancel to stop the run at any time. Results collected so far are preserved.

After the run completes, switch to the Results tab for the full breakdown. Failed assertions show the expected vs. actual values. Contract violations list the specific schema mismatches.

09

Exporting Results

Export your test results for CI integration or reporting. Click the export icon next to the Run All button and choose a format:

FormatUse caseFile
JUnit XMLCI/CD integration (Jenkins, GitHub Actions, GitLab CI)test-results.xml
JSONCustom dashboards, data analysis, programmatic accesstest-results.json

Both formats include the suite name, timestamps, duration per test, assertion details, and contract violations.

10

Scheduled Runs

Set up recurring test runs to continuously monitor your API. Go to the Schedule tab in the suite detail view:

  1. Enable the toggle for scheduled runs.
  2. Set the interval in minutes (default: 30 minutes).
  3. The suite will automatically run at the specified interval.

When a scheduled run completes with failures, SuagerUI sends a desktop notification with the suite name and pass/fail counts. All scheduled runs appear in the run history at the bottom of the Schedule tab.

πŸ’‘

Scheduled runs use the same variable context as manual runs. Make sure your global and suite variables are set up before enabling the schedule.

All rights reserved by SuagerUI

Made with β™₯️ from Los Angeles, CL Β· hi@suagerui.app