<?xml version="1.0" encoding="UTF-8"?>
<rss version="2.0" xmlns:atom="http://www.w3.org/2005/Atom" xmlns:dc="http://purl.org/dc/elements/1.1/">
  <channel>
    <title>DEV Community: Roman Glushach</title>
    <description>The latest articles on DEV Community by Roman Glushach (@romanglushach).</description>
    <link>https://dev.to/romanglushach</link>
    <image>
      <url>https://media2.dev.to/dynamic/image/width=90,height=90,fit=cover,gravity=auto,format=auto/https:%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Fuser%2Fprofile_image%2F1124848%2F20cdb701-b408-400a-ba34-99f451f6baec.jpeg</url>
      <title>DEV Community: Roman Glushach</title>
      <link>https://dev.to/romanglushach</link>
    </image>
    <atom:link rel="self" type="application/rss+xml" href="https://dev.to/feed/romanglushach"/>
    <language>en</language>
    <item>
      <title>Advanced Contract Testing Solution with High Scalability</title>
      <dc:creator>Roman Glushach</dc:creator>
      <pubDate>Sun, 23 Jul 2023 02:08:57 +0000</pubDate>
      <link>https://dev.to/romanglushach/advanced-contract-testing-solution-with-high-scalability-3e9l</link>
      <guid>https://dev.to/romanglushach/advanced-contract-testing-solution-with-high-scalability-3e9l</guid>
      <description>&lt;p&gt;In my &lt;a href="https://dev.to/romanglushach/the-advantages-of-contract-testing-comparing-pact-spring-cloud-contract-and-custom-scalable-solutions-14c0"&gt;previous article&lt;/a&gt;, I delved into the concept of contract testing, discussing its purpose, application, and implementation. In this piece, I will shift my focus to constructing a custom solution, examining the limitations of available tools and exploring potential solutions.&lt;/p&gt;

&lt;h2&gt;
  
  
  Why might you opt for a custom solution?
&lt;/h2&gt;

&lt;p&gt;In this article, I will briefly outline the limitations and shortcomings of existing tools such as Pact and .&lt;/p&gt;

&lt;p&gt;In general, both tools:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;do not utilize bi-directional flows in a producer/consumer-driven approach. While this is possible with Spring Cloud Contract, it is much more difficult to achieve with Pact.&lt;/li&gt;
&lt;li&gt;have their own language for writing tests. Spring Cloud Contract can read Pact contracts, but not vice versa. This can be achieved through plugins or containerisation, but it adds an additional layer of complexity.&lt;/li&gt;
&lt;li&gt;do not automatically trigger builds when changes are made to the contract.&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;Specifically, for Pact:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;a self-hosted broker is required, which must be accessible to both parties. This can pose a security issue when working with external parties.&lt;/li&gt;
&lt;li&gt;only a consumer-driven approach is implemented.&lt;/li&gt;
&lt;li&gt;there is no official support for asynchronous messages in PACT, only a community-based solution.&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;For Spring Cloud Contract:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;an artifactory is required to store contracts in jar format. This also applies to sharing with external parties.&lt;/li&gt;
&lt;li&gt;it is  and producer-driven by default.&lt;/li&gt;
&lt;li&gt;it utilizes a wrapped  instance under the hood.&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;In addition to addressing these limitations, a custom solution can also be designed to tackle future bottlenecks by:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;storing contracts in  Wiremock representation for easy migration and transition to new tools.&lt;/li&gt;
&lt;li&gt;using  format to generalize contracts for all systems and make them  with an easy  for all teams.&lt;/li&gt;
&lt;li&gt;using custom stages and triggers in pipelines based on changes.&lt;/li&gt;
&lt;/ul&gt;

&lt;h2&gt;
  
  
  Objective
&lt;/h2&gt;

&lt;p&gt;The aim of this project is to develop a highly scalable two-way method that is  and allows for a smooth transition to a different tool in the future.&lt;/p&gt;

&lt;h2&gt;
  
  
  Overview of the Structure
&lt;/h2&gt;

&lt;p&gt;&lt;a href="https://res.cloudinary.com/practicaldev/image/fetch/s--eWYKULJY--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_800/https://dev-to-uploads.s3.amazonaws.com/uploads/articles/aslxzynn542ggt97g2kf.png" class="article-body-image-wrapper"&gt;&lt;img src="https://res.cloudinary.com/practicaldev/image/fetch/s--eWYKULJY--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_800/https://dev-to-uploads.s3.amazonaws.com/uploads/articles/aslxzynn542ggt97g2kf.png" alt="Architecture overview" width="800" height="1348"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;h2&gt;
  
  
  A Detailed Explanation of the New Method
&lt;/h2&gt;

&lt;p&gt;As depicted in the image above, there is a  that manages the contracts between users. Ideally, each producer should have their own shared . This prevents the creation of a monolith and ensures a clear  and responsibilities.&lt;/p&gt;

&lt;p&gt;Let’s examine the new method from the perspective of the consumer.&lt;/p&gt;

&lt;p&gt;The consumer must make code modifications to receive messages from the producer. The next step is to establish a new contract in a shared . The shared  will then prompt the relevant producer to verify the contract, and if the pipeline is successful, we are ready to proceed.&lt;/p&gt;

&lt;p&gt;The same process applies to the producer, with the only difference being that after making changes to a contract, it will activate pipelines for all consumers.&lt;/p&gt;

&lt;h2&gt;
  
  
  Exploring Further with Code Examples
&lt;/h2&gt;

&lt;p&gt;As with any custom solution, it is helpful to have some guidelines to follow when setting up your first functional project and seeing it in action.&lt;/p&gt;

&lt;p&gt;The folder structure should resemble&lt;/p&gt;


&lt;div class="ltag_gist-liquid-tag"&gt;
  
&lt;/div&gt;


&lt;p&gt;This allows for the customization of triggers and stages within the pipeline for each team and .&lt;/p&gt;

&lt;p&gt;The contents of the 200. file may appear as straightforward as this&lt;/p&gt;

&lt;p&gt;Received message. Here's a rephrased version of the text: This allows for the customization of triggers and stages within the pipeline for each team and . &lt;/p&gt;

&lt;p&gt;The contents of the 200. file may appear as straightforward as this&lt;/p&gt;

&lt;p&gt;&lt;a href="https://res.cloudinary.com/practicaldev/image/fetch/s--xDe8F3Tl--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_800/https://dev-to-uploads.s3.amazonaws.com/uploads/articles/36nsf7nebvkb9229meod.png" class="article-body-image-wrapper"&gt;&lt;img src="https://res.cloudinary.com/practicaldev/image/fetch/s--xDe8F3Tl--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_800/https://dev-to-uploads.s3.amazonaws.com/uploads/articles/36nsf7nebvkb9229meod.png" alt="200. (sync)" width="424" height="321"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;To differentiate , a metadata object can be added.&lt;/p&gt;

&lt;p&gt;&lt;a href="https://res.cloudinary.com/practicaldev/image/fetch/s--vrWnntdZ--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_800/https://dev-to-uploads.s3.amazonaws.com/uploads/articles/txlzd9gokeba218hkq2u.png" class="article-body-image-wrapper"&gt;&lt;img src="https://res.cloudinary.com/practicaldev/image/fetch/s--vrWnntdZ--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_800/https://dev-to-uploads.s3.amazonaws.com/uploads/articles/txlzd9gokeba218hkq2u.png" alt="200. (async)" width="413" height="414"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;With asynchronous messages, all that is required is to retrieve the appropriate contract and test it using your own , without the need for any additional setup.&lt;/p&gt;

&lt;p&gt;On the producer side, automation is straightforward because the producer will have multiple consumers, and creating a test for each one would be time-consuming and repetitive.&lt;/p&gt;

&lt;p&gt;Let’s examine a simple  that can take all consumer tests and run them all at once without requiring any code changes on the producer side.&lt;/p&gt;

&lt;p&gt;&lt;a href="https://res.cloudinary.com/practicaldev/image/fetch/s--i8pgNYc9--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_800/https://dev-to-uploads.s3.amazonaws.com/uploads/articles/xarzarwsxbfbtzfpng6m.png" class="article-body-image-wrapper"&gt;&lt;img src="https://res.cloudinary.com/practicaldev/image/fetch/s--i8pgNYc9--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_800/https://dev-to-uploads.s3.amazonaws.com/uploads/articles/xarzarwsxbfbtzfpng6m.png" alt="producer wrapper" width="720" height="398"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;As shown in the image above, it cycles through all consumer contracts and performs basic validation, which can be further refined later. The code was written in , but it is possible to replicate it in any other language of your choosing because it retrieves the response from the local  stub server.&lt;/p&gt;

&lt;h2&gt;
  
  
  Integration with  Pipeline
&lt;/h2&gt;

&lt;p&gt;We’ll begin with a shared  repository that houses all of the producer’s contracts.&lt;/p&gt;

&lt;p&gt;Establish a common template that everyone can utilize.&lt;/p&gt;

&lt;p&gt;&lt;a href="https://res.cloudinary.com/practicaldev/image/fetch/s--S-naw9Km--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_800/https://dev-to-uploads.s3.amazonaws.com/uploads/articles/g10y03whcr3o8wdi0bi8.png" class="article-body-image-wrapper"&gt;&lt;img src="https://res.cloudinary.com/practicaldev/image/fetch/s--S-naw9Km--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_800/https://dev-to-uploads.s3.amazonaws.com/uploads/articles/g10y03whcr3o8wdi0bi8.png" alt="Shared template for shared contracts  repository" width="720" height="448"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;This is how the .gitlab-ci.yml file will appear when using the above template for each producer/consumer in this Git repository.&lt;/p&gt;

&lt;p&gt;&lt;a href="https://res.cloudinary.com/practicaldev/image/fetch/s--KEVpu5X2--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_800/https://dev-to-uploads.s3.amazonaws.com/uploads/articles/v2rfas7n7g4yx67etw3i.png" class="article-body-image-wrapper"&gt;&lt;img src="https://res.cloudinary.com/practicaldev/image/fetch/s--KEVpu5X2--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_800/https://dev-to-uploads.s3.amazonaws.com/uploads/articles/v2rfas7n7g4yx67etw3i.png" alt="consumer gitlab-ci.yml file in the shared contracts Git repository" width="720" height="207"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;Now, let’s develop a template for producer/consumer projects to streamline the integration process.&lt;/p&gt;

&lt;p&gt;&lt;a href="https://res.cloudinary.com/practicaldev/image/fetch/s--e476QZ88--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_800/https://dev-to-uploads.s3.amazonaws.com/uploads/articles/ekhyeqryjq00i5pdcnu0.png" class="article-body-image-wrapper"&gt;&lt;img src="https://res.cloudinary.com/practicaldev/image/fetch/s--e476QZ88--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_800/https://dev-to-uploads.s3.amazonaws.com/uploads/articles/ekhyeqryjq00i5pdcnu0.png" alt="producer/consumer shared template" width="720" height="172"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;As you may have noticed, I am utilizing sparse-checkout, which enables me to retrieve only the necessary files. From a consumer standpoint, you only need files that have been added or modified, and from a producer standpoint, you need all consumer files. This reduces the amount of data that needs to be fetched and allows for contract testing against specific contracts.&lt;/p&gt;

&lt;p&gt;To complete the build pipeline on the producer/consumer side, you must incorporate a template for retrieving the contracts discussed earlier and add a dependency before beginning . To further separate the processes, you can also divide  and  into stages and run them concurrently.&lt;/p&gt;

&lt;p&gt;&lt;a href="https://res.cloudinary.com/practicaldev/image/fetch/s--6oe_rC3K--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_800/https://dev-to-uploads.s3.amazonaws.com/uploads/articles/9osey8wg3jkpltwh05jn.png" class="article-body-image-wrapper"&gt;&lt;img src="https://res.cloudinary.com/practicaldev/image/fetch/s--6oe_rC3K--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_800/https://dev-to-uploads.s3.amazonaws.com/uploads/articles/9osey8wg3jkpltwh05jn.png" alt=" stages" width="661" height="628"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;Outcome using  Pipelines In the event of a contract modification on the consumer side&lt;/p&gt;

&lt;p&gt;&lt;a href="https://res.cloudinary.com/practicaldev/image/fetch/s--vXSKmXGX--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_800/https://dev-to-uploads.s3.amazonaws.com/uploads/articles/3idm06rajq8k79ytuxqp.png" class="article-body-image-wrapper"&gt;&lt;img src="https://res.cloudinary.com/practicaldev/image/fetch/s--vXSKmXGX--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_800/https://dev-to-uploads.s3.amazonaws.com/uploads/articles/3idm06rajq8k79ytuxqp.png" alt="consumer contract changes the pipeline" width="720" height="148"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;And this is when the contract was altered on the producer side&lt;/p&gt;

&lt;p&gt;&lt;a href="https://res.cloudinary.com/practicaldev/image/fetch/s--sYqLs6Tv--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_800/https://dev-to-uploads.s3.amazonaws.com/uploads/articles/9qzrdywitc1qfkk0avd2.png" class="article-body-image-wrapper"&gt;&lt;img src="https://res.cloudinary.com/practicaldev/image/fetch/s--sYqLs6Tv--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_800/https://dev-to-uploads.s3.amazonaws.com/uploads/articles/9qzrdywitc1qfkk0avd2.png" alt="producer contract changes the pipeline" width="720" height="171"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;Using  pipelines, you can establish an alert mechanism to notify a designated team in the event of a pipeline failure.&lt;/p&gt;

&lt;h2&gt;
  
  
  Conclusion
&lt;/h2&gt;

&lt;p&gt;This article outlines a highly scalable, custom solution that employs a bi-directional approach to contract testing. The solution can be easily expanded by simply incorporating additional stages into the Git pipeline, without increasing complexity.&lt;/p&gt;

</description>
      <category>contract</category>
      <category>testing</category>
      <category>pact</category>
      <category>spring</category>
    </item>
    <item>
      <title>The Advantages of Contract Testing: Comparing PACT, Spring Cloud Contract, and Custom Scalable Solutions</title>
      <dc:creator>Roman Glushach</dc:creator>
      <pubDate>Sun, 23 Jul 2023 01:43:44 +0000</pubDate>
      <link>https://dev.to/romanglushach/the-advantages-of-contract-testing-comparing-pact-spring-cloud-contract-and-custom-scalable-solutions-14c0</link>
      <guid>https://dev.to/romanglushach/the-advantages-of-contract-testing-comparing-pact-spring-cloud-contract-and-custom-scalable-solutions-14c0</guid>
      <description>&lt;p&gt;Contract testing is a method for verifying the integration of systems by individually examining each application to confirm that contracts and interfaces adhere to the mutually agreed upon terms.&lt;br&gt;
A mock integration point enables the confirmation of a component’s expected behavior without dependence on that component. In a large and intricate application, a trusted integration point may be required by multiple applications. This trust ensures that the integration point’s behaviors are validated by all dependent applications, safeguarding the system from unintended or harmful changes. Thus, a system can be constructed where each component performs a specific task, and the system is protected from accidental or malicious alterations to any component.&lt;/p&gt;
&lt;h2&gt;
  
  
  What are the advantages of utilizing contract testing and why is it a preferred choice?
&lt;/h2&gt;

&lt;p&gt;Contract testing is a highly effective technique for:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;Identifying irregularities in consumer workflows and addressing them at early stages&lt;/li&gt;
&lt;li&gt;Detecting service configuration defects that may impact inter-application communication&lt;/li&gt;
&lt;li&gt;Ensuring secure connections even when producers make changes to service configurations, providing guarantees to data consumers&lt;/li&gt;
&lt;li&gt;Allowing producers to perform their tasks without disrupting consumer workflows, which is particularly beneficial during regression testing&lt;/li&gt;
&lt;li&gt;Giving consumers the flexibility to define their requirements and consume only what they need&lt;/li&gt;
&lt;li&gt;Preventing unexpected API communication failures through the use of local or mock implementations, which are more stable, faster, and reliable during the application testing phase&lt;/li&gt;
&lt;li&gt;Facilitating rapid issue detection and resolution&lt;/li&gt;
&lt;/ul&gt;
&lt;h2&gt;
  
  
  Under what circumstances is contract testing not recommended?
&lt;/h2&gt;

&lt;p&gt;It is important to consider both the advantages and disadvantages before making a decision.&lt;/p&gt;

&lt;p&gt;Here are the main instances when contract testing may not be appropriate:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;Contract tests are not intended to replace Unit or Functional (component) tests&lt;/li&gt;
&lt;li&gt;Contract tests should not be used as a substitute for other types of tests&lt;/li&gt;
&lt;li&gt;If there is little or no communication between teams where contract tests are being set up, this can result in an unreliable and untrustworthy contract&lt;/li&gt;
&lt;li&gt;Using contract tests simply because they provide an additional layer of test coverage or because they are a new and trendy technique is not a valid reason and will not add value to your test flows&lt;/li&gt;
&lt;li&gt;Before making any decisions, it is important to evaluate the business value, estimated time of arrival for implementation, and consider the minimum viable product that can be provided and presented. It is also worth noting that integrating new features or tools requires workshops to onboard teams and users&lt;/li&gt;
&lt;/ul&gt;
&lt;h2&gt;
  
  
  Where do contract tests fall within the testing pyramid hierarchy?
&lt;/h2&gt;

&lt;p&gt;&lt;a href="https://res.cloudinary.com/practicaldev/image/fetch/s--6xfXVNuw--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_800/https://dev-to-uploads.s3.amazonaws.com/uploads/articles/zsigjlboqda7r3c4t4um.jpg" class="article-body-image-wrapper"&gt;&lt;img src="https://res.cloudinary.com/practicaldev/image/fetch/s--6xfXVNuw--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_800/https://dev-to-uploads.s3.amazonaws.com/uploads/articles/zsigjlboqda7r3c4t4um.jpg" alt="Testing pyramid" width="720" height="405"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;For a more detailed view, let’s examine the following table:&lt;/p&gt;


&lt;div class="ltag_gist-liquid-tag"&gt;
  
&lt;/div&gt;


&lt;h2&gt;
  
  
  What are the available tools and options for contract testing?
&lt;/h2&gt;

&lt;p&gt;There are a limited number of battle-tested and production-ready tools available for implementing contract testing. Some options include:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;&lt;img src="https://res.cloudinary.com/practicaldev/image/fetch/s--P2kvHhc3--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_800/https://docs.pact.io" alt="Pact" width="" height=""&gt;&lt;/li&gt;
&lt;li&gt;&lt;img src="https://res.cloudinary.com/practicaldev/image/fetch/s--LqJmSK6o--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_800/https://spring.io/projects/spring-cloud-contract" alt="Spring Cloud Contracts" width="" height=""&gt;&lt;/li&gt;
&lt;/ul&gt;

&lt;h2&gt;
  
  
  What factors should be considered when selecting the most suitable contract testing tool for your project?
&lt;/h2&gt;

&lt;p&gt;A brief overview of the capabilities of each tool can aid in making an informed decision:&lt;/p&gt;


&lt;div class="ltag_gist-liquid-tag"&gt;
  
&lt;/div&gt;


&lt;h2&gt;
  
  
  What are the default approaches or workflows utilized by each tool and how do they differ from one another?
&lt;/h2&gt;

&lt;p&gt;Let’s examine the characteristics of producer-driven contract testing.&lt;/p&gt;

&lt;p&gt;&lt;a href="https://res.cloudinary.com/practicaldev/image/fetch/s--Q8-l1BQM--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_800/https://dev-to-uploads.s3.amazonaws.com/uploads/articles/g9358ndiv9jp2txi2sjt.png" class="article-body-image-wrapper"&gt;&lt;img src="https://res.cloudinary.com/practicaldev/image/fetch/s--Q8-l1BQM--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_800/https://dev-to-uploads.s3.amazonaws.com/uploads/articles/g9358ndiv9jp2txi2sjt.png" alt="Producer-driven approach" width="800" height="553"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;In a producer-driven approach, the producer generates contracts and passes them on to consumers.&lt;/p&gt;

&lt;p&gt;Let’s delve deeper into the workings of the Spring Cloud Contract tool and explore its behind-the-scenes operations.&lt;/p&gt;

&lt;p&gt;&lt;a href="https://res.cloudinary.com/practicaldev/image/fetch/s--r-5xD20z--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_800/https://dev-to-uploads.s3.amazonaws.com/uploads/articles/685w9fpnyi00kv1nnvg2.png" class="article-body-image-wrapper"&gt;&lt;img src="https://res.cloudinary.com/practicaldev/image/fetch/s--r-5xD20z--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_800/https://dev-to-uploads.s3.amazonaws.com/uploads/articles/685w9fpnyi00kv1nnvg2.png" alt="Spring Cloud Contract workflow" width="800" height="696"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;Let’s now examine the workflow of consumer-driven contract testing.&lt;/p&gt;

&lt;p&gt;&lt;a href="https://res.cloudinary.com/practicaldev/image/fetch/s--LrtV6RoQ--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_800/https://dev-to-uploads.s3.amazonaws.com/uploads/articles/ob3iblqlm9fzdb6apzrs.png" class="article-body-image-wrapper"&gt;&lt;img src="https://res.cloudinary.com/practicaldev/image/fetch/s--LrtV6RoQ--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_800/https://dev-to-uploads.s3.amazonaws.com/uploads/articles/ob3iblqlm9fzdb6apzrs.png" alt="Consumer-driven approach" width="800" height="657"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;The following image depicts the functionality of Pact&lt;/p&gt;

&lt;p&gt;&lt;a href="https://res.cloudinary.com/practicaldev/image/fetch/s--I5cFeEYP--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_800/https://dev-to-uploads.s3.amazonaws.com/uploads/articles/33bovmsbitd6k0y4jofq.png" class="article-body-image-wrapper"&gt;&lt;img src="https://res.cloudinary.com/practicaldev/image/fetch/s--I5cFeEYP--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_800/https://dev-to-uploads.s3.amazonaws.com/uploads/articles/33bovmsbitd6k0y4jofq.png" alt="Pact workflow" width="800" height="707"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;h2&gt;
  
  
  How to establish a new contract?
&lt;/h2&gt;

&lt;h3&gt;
  
  
  Add new contract
&lt;/h3&gt;

&lt;ul&gt;
&lt;li&gt;Create a new contract&lt;/li&gt;
&lt;li&gt;Store the contract in the contract repository&lt;/li&gt;
&lt;li&gt;Conduct a review of the contract&lt;/li&gt;
&lt;li&gt;Develop consumer-side tests&lt;/li&gt;
&lt;li&gt;Develop producer-side tests&lt;/li&gt;
&lt;li&gt;Integrate the contract into the codebase&lt;/li&gt;
&lt;li&gt;Integrate consumer-side tests into the codebase&lt;/li&gt;
&lt;li&gt;Integrate producer-side tests into the codebase&lt;/li&gt;
&lt;/ul&gt;

&lt;h3&gt;
  
  
  Update existing contract
&lt;/h3&gt;

&lt;ul&gt;
&lt;li&gt;Modify the existing contract&lt;/li&gt;
&lt;li&gt;Store the updated contract in the contract repository&lt;/li&gt;
&lt;li&gt;Conduct a review of the updated contract&lt;/li&gt;
&lt;li&gt;Implement changes on each consumer’s side&lt;/li&gt;
&lt;li&gt;Implement changes on each producer’s side&lt;/li&gt;
&lt;li&gt;Integrate the updated contract into the codebase&lt;/li&gt;
&lt;li&gt;Integrate changes on the consumer’s side into the codebase&lt;/li&gt;
&lt;li&gt;Integrate changes on the producer’s side into the codebase&lt;/li&gt;
&lt;/ul&gt;

&lt;h2&gt;
  
  
  When Should Contract Tests be Executed? Integration into the Development Pipeline
&lt;/h2&gt;

&lt;ul&gt;
&lt;li&gt;Build Phase:

&lt;ul&gt;
&lt;li&gt;Compile the code&lt;/li&gt;
&lt;li&gt;Generate contract files&lt;/li&gt;
&lt;/ul&gt;


&lt;/li&gt;
&lt;li&gt;Test Phase (conducted in parallel):

&lt;ul&gt;
&lt;li&gt;Execute unit tests&lt;/li&gt;
&lt;li&gt;Run integration tests&lt;/li&gt;
&lt;li&gt;Perform contract tests (consider implementing a safe failure backup plan for quick production deployment during incidents)&lt;/li&gt;
&lt;li&gt;Conduct other automated tests&lt;/li&gt;
&lt;/ul&gt;


&lt;/li&gt;
&lt;li&gt;Deployment Phase:

&lt;ul&gt;
&lt;li&gt;Deploy the code to the production environment&lt;/li&gt;
&lt;/ul&gt;


&lt;/li&gt;
&lt;/ul&gt;

&lt;h2&gt;
  
  
  Conclusion
&lt;/h2&gt;

&lt;p&gt;In this piece, we delved into the concept of contract testing, weighing its advantages and disadvantages, and provided insights to aid in making informed decisions.&lt;/p&gt;

&lt;h2&gt;
  
  
  Next Steps
&lt;/h2&gt;

&lt;p&gt;In the &lt;a href="https://dev.to/romanglushach/advanced-contract-testing-solution-with-high-scalability-3e9l"&gt;following article&lt;/a&gt;, we will demonstrate how to construct a highly scalable solution utilizing pipelines from GitHub or GitLab.&lt;/p&gt;

</description>
      <category>contract</category>
      <category>pact</category>
      <category>spring</category>
      <category>testing</category>
    </item>
  </channel>
</rss>
