Hello everyone, I’m a student working part-time at...
# general
f
Hello everyone, I’m a student working part-time at a company, and as part of a university project in collaboration with the company, I’m exploring how to adapt contract testing for several of our projects. Currently, we use Pact for contract testing in some REST projects, but I’m investigating its suitability for other protocols we use, specifically WebSocket, SSE, and MQTT. From my research so far: • I’ve learned that Pact does not support MQTT (at least for now). • For WebSocket and SSE, I’ve found mixed information, and I’m unsure whether Pact is a viable or recommended option for these protocols. Before diving into setting up an experimental test environment, I wanted to ask: • Has anyone here implemented contract testing for WebSocket or SSE using Pact? • If so, do you think it’s a good approach, or are there alternative tools better suited for these use cases? Thank you in advance for your insights and time!
b
While maintainers haven't responded, I'll chip in. You probably want to search for
pact-message
and/or the keywords "message pact" on docs.pact.io. The implementation approach is more abstract than the very-concrete ReST style, eschewing protocol-specific details, and focusing just on the messages sent & received.
f
Thank you that will be a good start for me. Maybe someone can chip in about possible MQTT but i think there is little hope. But definitly thanks for your first response ^^
b
np, good luck!
s
You mentioned a blog - don't forget to add useful content and articles to this page 👉 https://docs.pact.io/blogs_videos_and_articles
b
and maybe more on that ☝️ page, but not all the titles are decipherable 😅
j
I missed this initially, but as Boris mentioned, what you're looking for at Message Pacts. They abstract the underlying protocol entirely, so whether you're sending payloads over MQTT, AWS SQS, Kafka, etc., you can still validate the payloads and metadata. Of course, if you're trying to validate an aspect specific to the protocol itself, Pact won't be able to do (but I also don't think that's within the realm of what Pact should check)
m
Further to the above, here are some additional useful resources: 1. Basics on message pact: https://docs.pact.io/getting_started/how_pact_works#non-http-testing-message-pact 2. AMA on the topic (april ’21): https://docs.pact.io/help/amas#april-2021 3. Workshop: a. Material: https://docs.pact.io/university/message-pact-async/00_1_Intro b. Video:

https://www.youtube.com/watch?v=81N25-4x27E