2 Days: Beyond Contract Testing - Contract Driven Development
In this masterclass, Naresh Jain (co-author of Specmatic) will give you an in depth, hands-on introduction to Contract Driven Development (CDD). You will learn how to use OpenAPI specifications as executable contracts to achieve parallel development and independent deployment of your microservices & micro-frontends. In this process, you’ll learn how to shift-left the identification of integration issues to achieve quicker time to market. This masterclass is hand-crafted to provide Developers, Architects and Quality Engineers the essential techniques to foster a collaborative API Design first culture in their teams.
The masterclass will cover:
- The need to “Shift Left” - Why is integration testing ineffective? How you can leverage contract testing and service virtualisation to validate your services conformance to API Specs to identify integration issues early.
- API Design First Approach - How to collaboratively evolve API design and avoid rework.
- Backward Compatibility Testing - Via a PR process, ensure backward breaking changes are prevented during API design rather than catching them during integration testing.
- Generative Contract Testing - Building secure and resilient MicroServices by achieving higher API Coverage with Generative Tests (inspired by Property Based and Mutation Testing).
- Intelligent Service Virtualization - Cheap, Fast, Reliable Tests in a controlled environment using dependency-emulation & fault-injection.
- AI Test Data Management - Instantly generate domain specific test data by using the context in your API spec with GenAI.
- Service Dependency Visualization - make informed architectural decisions based on deep integration insights.
- Fix API Spec and Implementation conformance mismatches - Run tests locally and as hard-gates in CI pipeline to ensure API Conformance.
- Measure Progress - Metrics to track CDD adoption and outcomes.
Agenda:
Day 1
- Introductions
- Why is microservices architecture not yielding the expected results?
- Quick review of Test Pyramid and various types of tests
- Sneak-peek into Contract Driven Development in action
- Leveraging API Specifications as Contract Tests - Using OpenAPI specs to generate contract tests in seconds without writing code
a. Hands-on Lab 1 - API Coverage Report - Identify mismatch between your spec and implementation
- Understanding the difference between Contract Test and API Tests
- Types of contract testing and their mechanics - Consumer Driven, Provider Driven, Bi-directional. Understanding their pros and cons.
- How Contract Driven Development differs and also addresses the issues with traditional contract testing.
- Using OpenAPI Examples as Test Data
a. Hands-on Lab 2
Lunch Break
- Generating context aware domain relevant OpenAPI examples with Generative AI
a. Hands-on Lab 3 - Generative Tests - ensure Testing boundary conditions of your API specification
a. Hands-on Lab 4 - Externalising test data
a. Hands-on Lab 5 - Central Contract Repo - Single source of truth for your API specifications, pre-merge checks on central contract repository - API Spec Linting
- No code backward compatibility Testing and API Versioning Strategies to prevent backward breaking changes at API design stage
a.Hands-on Lab 6 - Why Doc Gen (generating API spec from code) and Code Gen (generating code from API spec) does not guarantee that the API spec adheres to the code and vice versa
- Q & A
Day 2
- Recap of Day 1
- Using API Specifications for Intelligent Service Virtualization to isolate dependencies
a. Hands-on Lab 7 - OpenAPI Examples as Stub Data
a. Hands-on Lab 8 - Recording API specifications and stub response
a. Hands-on Lab 9 - Mocking other dependencies such as databases
a. Demo - Externalizing stub data
Lunch Break
- Fault Injection testing - Delay simulation, error and empty responses and more
a. Hands-on Lab 10 - Running contract tests in CI pipelines
a. Hands-on Lab 11 - Visualizing your architectural dependencies - Detecting integration risks, deprecation candidates and more
- CDD Metrics - Tracking health, value and outcome of your CDD adoption journey
- Developer workflow with CDD - Contract tests to drive development of a new API implementation followed by GenAI to write your unit tests
- Starting CDD adoption in your organization and anit-patterns to watch out for
- Q & A
Prerequisites
This masterclass involves hands-on coding labs and group exercises. Bring your laptop. The labs will involve basic Java, Python or TS projects. Familiarity with API specifications such as OpenAPI / Swagger, AsyncAPI will be helpful, but not mandatory. Experience building and deploying microservices/micro-frontends will help you appreciate these labs.