Consumer Driven Contract Testing with Node.js & Pact

0
13

a.k.a. verification across service boundaries

Making sure that we’re not breaking our clients’ code is a real challenge in the world of APIs. As a full-stack software consultant working with growing microservice architectures I have to feel the pain of both the server and client. I’d like to present a clean way to make sure everyone stays happy, and things don’t break (or at least we know ahead of time if they are). Those who watch my keynote will be familiar with the concepts of contract testing and will get to know a small library called Pact that can help integrating it into their current software development workflow.

You can download Peter’s presentation here.

Topics discussed:

  • What types of tests can you use?
  • What are the pros and cons of each of them?
  • The importance of testing beyong borders (a.k.a. testing multiple codebases).
    • Mocking: creating a mock object for testing for a single test case. Recommended library: Nock.
    • Using an instance of the upstream service – using other team’s code to test different elements. It is trustworthy, however, it’s often difficult to work with other team’s code.
  • Extra solution: Contract testing – by contract we are defining an interface. Both parties use the interface to test. Quick, stable, reliable.
  • Consumer-driven contract testing with Pact with a Node.js code example. Peter goes through the steps of implementation with the clients.
  • Pact – Implementation of a consumer driven contract test suite.

Node.js Budapest Meetup by RisingStack

About NodeBP

With the first rays of the spring sun, we thought it was about time to organize the first Node.js Meetup of 2018 in Budapest!

The meetup took place on the 27th of March at the LogMeIn office space – with over 80 attendees. There were two presentations; one by our senior engineer, Peter Czibik, the other by Szabolcs Szabolcsi-Tóth, Senior engineer at IBM.

There was a friendly get-together in Anker Club after the meetup, where attendees could network, and discuss any topics next to a beer. Nice atmosphere, nice people, nice beer – could we ask for more?

Check out the photos of the meetup

IMG_3175

IMG_3184

IMG_3183

IMG_3181

IMG_3178

IMG_3172

Do you have any questions? Let Peter know in the comment section below.