All Projects → SrinivasanTarget → ContractTestingBoilerplate

SrinivasanTarget / ContractTestingBoilerplate

Licence: other
Contract Testing Boilerplate for the microservices developed using Spring Boot and Kafka in a maven multi-module project.

Programming Languages

java
68154 projects - #9 most used programming language
Dockerfile
14818 projects
groovy
2714 projects

Projects that are alternatives of or similar to ContractTestingBoilerplate

pact-example
Example project to demonstrate Contract Testing via Pact.
Stars: ✭ 58 (+61.11%)
Mutual labels:  pact, contract-testing, consumer-driven-contracts, pact-broker, spring-cloud-contract, pact-jvm
README
Developer Relations @ Pact - Your map to the Pact landscape for all-comers (maintainers, contributors, users, newbies)
Stars: ✭ 35 (-2.78%)
Mutual labels:  pact, contract-testing, consumer-driven-contracts, pact-broker
awesome-contract-testing
Awesome resources for Consumer-Driven Contract Testing
Stars: ✭ 54 (+50%)
Mutual labels:  pact, consumer-driven-contracts, pact-broker
spring-projects
Some spring sample projects
Stars: ✭ 24 (-33.33%)
Mutual labels:  pact, spring-cloud-contract
terraform-provider-pact
Terraform provider for Pact Broker (and Pactflow)
Stars: ✭ 21 (-41.67%)
Mutual labels:  pact, pact-broker
sample-testing-microservices
sample applications with implementation of unit, component, contract and integrarion tests using pact, gatling, spring boot test and hoverfly
Stars: ✭ 22 (-38.89%)
Mutual labels:  pact, contract-testing
pact-consumer-swift
A Swift / ObjeciveC DSL for creating pacts.
Stars: ✭ 89 (+147.22%)
Mutual labels:  pact, contract-testing
karate-runner
VSCode Extension for Karate
Stars: ✭ 23 (-36.11%)
Mutual labels:  testing-tools, contract-testing
jest-pact
A Pact adaptor for to allow you to easily run tests with Jest
Stars: ✭ 58 (+61.11%)
Mutual labels:  pact, consumer-driven-contracts
testing-microservices-introduction
Learn some of the high level microservices testing cases with hands on examples.
Stars: ✭ 27 (-25%)
Mutual labels:  microservices-testing, pact
karate
Test Automation Made Simple
Stars: ✭ 6,384 (+17633.33%)
Mutual labels:  testing-tools, contract-testing
Karate
Test Automation Made Simple
Stars: ✭ 5,497 (+15169.44%)
Mutual labels:  testing-tools, contract-testing
vision-ui
视觉UI分析工具
Stars: ✭ 165 (+358.33%)
Mutual labels:  testing-tools
nirvana-teste-de-contrato
Example of how to implement nirvana of contract testing with Pact following all the practices described in https://docs.pact.io/pact_nirvana
Stars: ✭ 71 (+97.22%)
Mutual labels:  pact
fluttertest
Custom flutter testing CLI tool for individual test runs and group testing
Stars: ✭ 15 (-58.33%)
Mutual labels:  testing-tools
MQBench Quantize
QAT(quantize aware training) for classification with MQBench
Stars: ✭ 29 (-19.44%)
Mutual labels:  pact
oz
Oz is a behavioral web-ui testing framework developed to reduce test maintenance by using a predictive model rather than a scriptive model when writing tests.
Stars: ✭ 23 (-36.11%)
Mutual labels:  testing-tools
divo
Docker Integration and Validation Orchestrator for Elixir with Mix
Stars: ✭ 31 (-13.89%)
Mutual labels:  testing-tools
kentan
A modular test data generator for TypeScript
Stars: ✭ 38 (+5.56%)
Mutual labels:  testing-tools
Pywinauto
Windows GUI Automation with Python (based on text properties)
Stars: ✭ 3,175 (+8719.44%)
Mutual labels:  testing-tools

Contract Testing Boilerplate

Contract Testing Boilerplate has two microservices developed using Spring Boot in a maven multi-module project.

What is Contract Testing?

An integration contract test is a test at the boundary of an external service verifying that it meets the contract expected by a consuming service.

  • Date Provider MicroService - /provider/validDate - Validates whether given date is a valid date or not
  • Age Consumer MicroService - /age-calculate - Returns age of a person based on given date

Microservices

Start Date Provider MicroService by default runs in port 8080:

mvn spring-boot:run -pl date-provider

Start Age Consumer MicroService by default runs in port 8081:

mvn spring-boot:run -pl age-consumer

Pact Tests

Click to expand!

Pact is a contract testing tool. Contract testing is a way to ensure that services (such as an API provider and a client) can communicate with each other. Without contract testing, the only way to know that services can communicate is by using expensive and brittle integration tests.

Run Consumer contract Tests

mvn clean test -pl age-consumer

Generated Pact file:

{
  "provider": {
    "name": "dateProvider"
  },
  "consumer": {
    "name": "ageConsumer"
  },
  "interactions": [
    {
      "description": "valid date from provider",
      "request": {
        "method": "GET",
        "path": "/provider/validDate",
        "query": {
          "date": [
            "2001-02-03"
          ]
        },
        "matchingRules": {
          "query": {
            "date": {
              "matchers": [
                {
                  "match": "date",
                  "date": "2001-02-03"
                }
              ],
              "combine": "AND"
            }
          }
        },
        "generators": {
          "body": {
            "date": {
              "type": "Date",
              "format": "2001-02-03"
            }
          }
        }
      },
      "response": {
        "status": 200,
        "headers": {
          "content-type": "application/json",
          "Content-Type": "application/json; charset=UTF-8"
        },
        "body": {
          "month": 8,
          "year": 2000,
          "isValidDate": true,
          "day": 3
        },
        "matchingRules": {
          "body": {
            "$.year": {
              "matchers": [
                {
                  "match": "number"
                }
              ],
              "combine": "AND"
            },
            "$.month": {
              "matchers": [
                {
                  "match": "number"
                }
              ],
              "combine": "AND"
            },
            "$.day": {
              "matchers": [
                {
                  "match": "number"
                }
              ],
              "combine": "AND"
            },
            "$.isValidDate": {
              "matchers": [
                {
                  "match": "type"
                }
              ],
              "combine": "AND"
            }
          },
          "header": {
            "Content-Type": {
              "matchers": [
                {
                  "match": "regex",
                  "regex": "application/json(;\\s?charset=[\\w\\-]+)?"
                }
              ],
              "combine": "AND"
            }
          }
        }
      },
      "providerStates": [
        {
          "name": ""
        }
      ]
    }
  ],
  "metadata": {
    "pactSpecification": {
      "version": "3.0.0"
    },
    "pact-jvm": {
      "version": "4.0.9"
    }
  }
}

Start Pact Broker at default port :8282

docker-compose up -d

Publish Pact Files in Pact Broker

$ cd age-consumer
$ mvn pact:publish

Verify Pacts in Pact Broker at Provider side

mvn clean -Dtest=PactAgeProviderTest test -pl date-provider

Pact Broker

Spring Cloud Contract Tests

Click to expand!

Spring Cloud Contract is an umbrella project holds solutions to help users implement contract tests. It has two main modules:

  • Spring Cloud Contract Verifier, which is used mainly by the producer side.
  • Spring Cloud Contract Stub Runner, which is used by the consumer side.

Blogs

Note that the project description data, including the texts, logos, images, and/or trademarks, for each open source project belongs to its rightful owner. If you wish to add or remove any projects, please contact us at [email protected].