Skip to content

About

Examples of contract tests

Resources

Stars

4 stars

Watchers

1 watching

Forks

Latest commit

 

History

60 Commits

Folders and files

Repository files navigation

Examples of Contract Tests

This repository contains example usage of contract tests using two frameworks:

Application

Both projects use very simple application to show how to test communication using contract testing. This application consists of two services:

  • payment-service, which exposes the REST API (producer)
  • order-service, which is a consumer of the REST API (consumer)

Request

Response

Contracts of REST API are located in /src/contractTest/resources/contracts/orderService in payment-service repository

To generate the tests and stub you should ececute Gradle's build:

./gradlew build

Executing this command generates:

  • The test which confirm that REST API of payment-service conforms requirements written down in the contract
  • The stub which corresponds to the requirements in the contract

Generated test is located under /build/generated-test-sources/contractTest/groovy/com/rmaciak/payment/OrderServiceSpec.groovy

The stub is located under /build/libs/payment-service-0.0.1-SNAPSHOT-stubs.jar

About

Examples of contract tests

Resources

Stars

4 stars

Watchers

1 watching

Forks

Releases

Packages

Contributors

Languages