Skip to content
This repository was archived by the owner on Jun 5, 2026. It is now read-only.

Repository files navigation

k6 API contract validation example

This is a complete example of API contract validation in k6 using the expect library.

Contracts are stored in ./api_contracts folder as .js files. Contracts can also be standard .json files if there's no need to compose complex contracts from multiple objects.

Contract format

API contracts follow the JSON Schema format. Under the hood, the expect library is using Ajv JSON schema validator developed by Mozilla.

About this example

The example script validates API contracts of selected services from https://test-api.k6.io/.

Screenshots

k6 run k6-API-contract-validation-example.js k6 CLI

k6 cloud k6-API-contract-validation-example.js k6 cloud

About

No description or website provided.

Topics

Resources

Stars

5 stars

Watchers

142 watching

Forks

Releases

Packages

Used by

Contributors

Languages