Skip to content

ramafasa/contract-tests

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

60 Commits
 
 
 
 
 
 
 
 
 
 
 
 

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

Watchers

Forks

Releases

No releases published

Packages

No packages published