Upgrade to Pro — share decks privately, control downloads, hide ads and more …

Using API specs as executable contracts to moc...

Using API specs as executable contracts to mock and test microservices

HariKrishnan

October 30, 2024
Tweet

More Decks by HariKrishnan

Other Decks in Programming

Transcript

  1. © 2024 All Rights Reserved Using API specs as executable

    contracts to mock and test microservices @harikrishnan83 Hari Krishnan Co-Founder and CTO at Specmatic
  2. © 2024 All Rights Reserved Production Mode Client Order Service

    place_order process_order notification 4 Send 1 Receive 2 Send 3 Send Receive 5
  3. © 2024 All Rights Reserved Test Google Pub Sub Dependencies

    place_order process_order notification PubSub Emulator Test Mode – Contract Test Setup System Under Test Order Service 1 Send 2 Receive 3 Send 4 Send Verify message count and schema 5 The messages adhere to the schema defined in the spec Message is received on process_order and notification topics Contract Test
  4. © 2023 All Rights Reserved Live Demo Google PubSub -

    Contract Testing with AsyncAPI specifications
  5. © 2024 All Rights Reserved Contract Driven Development – In

    a nutshell Consumer Provider API Design First • Shift Left all the way to Design • Reduced time-to-market due to Parallel Development • Enhanced DevEx with improved Collaboration • Resilient API Building Blocks
  6. © 2024 All Rights Reserved Sample projects Google Pub Sub

    - https://github.com/znsio/specmatic-google-pubsub-sample Kafka - https://github.com/znsio/specmatic-kafka-sample