2 min read

Contract-Based Testing

Contract-Based Testing

Mariusz is an expert in contract-based testing. In this interview, we talk about what CBT is all about, how it solves annoying problems in integration testing and how it works in general. Mariusz shows us what consumer and producer are all about, which framework he uses and lists typical pitfalls that this type of testing entails.

“All the interactions are mocked up and a finished implementation is not necessary at this point” - Mariusz Smoliński

Mariusz has been working in the IT industry for over 12 years. He started out as an IT service desk employee in support projects for German customers in banking, industry and the public sector. Almost 4 years later he switched to testing and has remained there to this day.
He has ensured software quality in various projects in different industries in England and Germany. He prefers to work agile. Privately, he is involved in iOs development, among other things.

Highlights of this episode:

  • Contract-based testing is particularly useful in projects with microservices and APIs
  • It defines a kind of contract between two parties: the provider and the consumer of the interface
  • PACT is one of the best-known frameworks for contract-based testing
  • Contract Based Testing allows you to test the interaction with APIs at unit test level without calling the API directly
  • The tests can be integrated into the CI pipeline to ensure that everything works smoothly
  • Contract-based testing encourages collaboration and helps to understand what the other party really needs from the interface
  • It is important not to try to test too much with contract based testing as it is mainly intended for unit testing
  • A pact broker helps to always work with the latest version of the interface

Contract-Based Testing: A deep insight

Discover the world of contract-based testing, an innovative method for optimizing interface testing in agile projects. Find out how this method promotes collaboration and makes testing processes more efficient.

Contract-Based Testing

In my latest podcast episode, we looked at contract-based testing - an approach that is revolutionizing the testing of interfaces. This method is particularly useful in today’s world, where microservices and various APIs dominate. In an insightful conversation with Mariusz Smoliński, an experienced user of contract-based testing in agile projects, we discussed the concept, its application and its many benefits. This approach not only keeps the documentation of the interface up to date, but also promotes collaboration between the teams.

What is contract-based testing?

Contract-based testing can be understood as a kind of contract between two parties: the provider and the user of an interface. All interactions are precisely defined. This process helps to optimize communication between backend and frontend or between different services within an organization. The aim is to develop and test only what the consumer really needs - a principle also known as “you aren’t gonna need it”.

The role of PACT as a framework

One of the best-known frameworks for supporting contract-based testing is PACT. It enables simple implementation and promotes collaboration between the parties involved. The use of a so-called pact broker allows contracts to be made easily accessible and up-to-date documentation is always available.

Contract-Based Testing in Aktion

An interesting application of contract-based testing is the possibility of mocking certain interface interactions. This simplifies the testing process considerably, as there is no need to wait until the other side has completed its implementation. This method also means that only those aspects that are important to the consumer are developed and tested. This makes the development process more efficient and goal-oriented.

Limits and challenges

Despite its many advantages, there are situations where contract-based testing may not be ideal. For example, with public APIs or when there is no control over changing data. Political decisions within a project can also influence the implementation of this test method.

Concluding thoughts

The introduction of contract-based testing offers many advantages: it saves time, promotes clear communication between teams and ensures up-to-date documentation. However, it is important to know when this method is appropriate and when other tools would be more suitable. Mariusz shared valuable insights from his practical experience, making this episode a real treasure trove of information.

.

Test Pyramid - A Critical Look

Test Pyramid - A Critical Look

Everyone knows the test pyramid, everyone immediately has its image in mind. Sometimes it has three floors, sometimes four. But it is worth...

Weiterlesen
Game Testing

Game Testing

Oliver introduces us to the exciting topic of how to actually test computer games. Specifically, we talk about the MMORPGTibia. He talks about the...

Weiterlesen
ChatGPT for Test

ChatGPT for Test

Language models have been around for a long time. But the release of ChatGPT hit like a bomb. Maybe that’s because it’s so easy to access. I think...

Weiterlesen