0.24.1 • Published 3 years ago

qontract v0.24.1

Weekly downloads
26
License
ISC
Repository
github
Last release
3 years ago

Deprecation Notice

Qontract is now renamed to Specmatic All new development and bug fixes will be available in Specmatic.


Qontract is a contract driven development tool that allows us to turn our contracts into executable specification.

Quick Start

npm install qontract will install the qontract locally to the node project.

Sample npm scripts to run qontract, with *.qontract as the path of qontract files and src/mocks as the path for the stub data directory (Check Documentation for more information on cli commands and arguments.)

"qontract-stub": "qontract stub *.qontract --data src/mocks --host=localhost --port=8000"

"qontract-test": "qontract test *.qontract --host=localhost --port=8000"

Qontract in stub mode (For consumers)

In stub mode, Qontract provides random responses to requests that match the contract. It’s a way of exploring what the contract looks like. This is meant to be used by anyone who wants to take a fake version of the API for a spin. This mode can also stub out real requests and responses, which will be validated against the contract before being accepted.

Qontract tests (For Providers)

In test mode, Qontracts accepts a contract file, and the hostname and port of the service whose API is being tested. It then sends an HTTP request based on the request format described in the contract for every scenario, generating random values where no examples are given. When the service responds, it validates the response based on the format in the contract. This is meant to be used by API providers.

API

Check Documentation for more information on cli commands and arguments.

Test helper library

import { startStubServer, startTestServer, loadDynamicStub } from 'qontract';

Qontract JS library exposes methods which can be used in your JS project to setup the tests, as well as do advanced things like load stubs dynamically.

startStubServer(qontractDir: string, stubDir: string, host: string, port: string)

method to start the stub server.

startTestServer(qontractDir: string, host: string, port: string)

method to start test server.

loadDynamicStub(stubPath: string)

method to load stub dynamically from inside an automated test.

0.24.1

3 years ago

0.21.2-5

3 years ago

0.21.2-4

3 years ago

0.21.2-3

3 years ago

0.21.2-2

3 years ago

0.21.8

3 years ago

0.21.2-1

3 years ago

0.21.6

3 years ago

0.21.5

3 years ago

0.21.4

3 years ago

0.21.2-0

3 years ago

0.21.2

3 years ago

0.21.1

3 years ago

0.19.1

4 years ago

0.18.0

4 years ago

0.14.0

4 years ago

0.12.0

4 years ago

0.11.0

4 years ago

0.10.0

4 years ago

0.9.0

4 years ago

0.8.0

4 years ago

0.7.0

4 years ago

0.6.0

4 years ago

0.5.0

4 years ago

0.4.0

4 years ago

0.3.0

4 years ago

0.2.0

4 years ago

0.1.0

4 years ago

0.0.1

4 years ago

1.2.3

4 years ago

1.2.2

4 years ago

1.2.1

4 years ago

1.2.0

4 years ago

1.1.0

4 years ago

1.0.0

4 years ago