
In this article we will discuss working with Contract Testing with Pact in C# .NET language binding.
Before getting into Contract testing, lets first discuss the problem we have with Testing pyramid layers like Unit testing layer, Integration layer and E2E layer.



In order to overcome all the problems, contract testing comes into picture and looks very promising.
Contract Testing
Contract testing is immediately applicable anywhere where you have two services that need to communicate – such as an API client and a web front-end. Although a single client and a single service is a common use case, contract testing really shines in an environment with many services (as is common for a microservice architecture). Having well-formed contract tests makes it easy for developers to avoid version hell. Contract testing is the killer app for microservice development and deployment.
In general, a contract is between a consumer (for example, a client that wants to receive some data) and a provider (for example, an API on a server that provides the data the client needs).
Contract Testing with Pact
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
How Pact works ?
Here is how Pact works

Here is the complete video of the above discussion
The above video has demo which will be part of the course “API testing with Restsharp and Specflow in C#” course in Udemy

Thanks for reading the article and watching the video !
Please leave your valuable rating and comments on the video and let me know if I need to add any details in the article.
Thanks,
Karthik KK
The udemy course is of 9hours from that contact contract testing related video is for of 54mins videos , so it would be better if in details separate videos for contract testing using pact is available.