<@U9VHUPVPX> we are experimenting with pact testin...
# pact-ruby
m
@Beth (pactflow.io/Pact Broker/pact-ruby) we are experimenting with pact testing messages. We use kafka, and we want to be able to test the following: 1. MyConsumer sends a message to TopicA 2. MyProvider does some stuff and sends a message to TopicB It looks like that the pact-message-ruby have some testing capabilities to assert on the message MyProvider sends to TopicB that it has to be certain structure and type. However, we don't see any expectations on the message MyConsumer sends to TopicA that trigs the response from MyProvider. Is my understanding correct?
đź‘‹ 1
m
Hi Michelle!
In Pact message, each part of that sequence should be tested in isolation
i.e.
MyConsumer
->
TopicA
: Actually,
MyConsumer
is a “provider” in this case. It’s producing a message (1)
MyProvider
->
TopicB
: Likewise,
MyProvider
is a “provider” in this case as it’s producing a message (2) My assumption is that
MyProvider
actually gets the message first from
TopicA
, in which case it’s also a consumer (3)
So actually there would be a few tests here. You would start with (3) - write the consumer test first. Then implement the provider verification (1). You would then write the consumer test for the app that reads from
TopicB
(4 - it’s not clear on who is consuming from that topic, is it
MyConsumer
again?) Once you’ve done this, you would verify that the message sent to
TopicB
is correct (2) This section of the docs that might help too: https://docs.pact.io/getting_started/how_pact_works#non-http-testing-message-pact
If my assumption about it being essentially an asynchronous request/response message, to further clarify, there are two pairs of tests between the applications. One where
MyConsumer
is the consumer and one where it is the provider.
m
Hi Matt, thank you for responding. This is helpful!
🙌 1