API Testing · Senior · Question 20 of 75
How do you test an event-driven API that publishes to a message broker?
- 1Consume the topic in tests and check payload, keys and schema
- 2Only check the HTTP response of the call that caused it
- 3Event-driven systems can only be tested in production
Show the answer
Correct answer: Consume the topic in tests and check payload, keys and schema
Explanation
The HTTP call may succeed while the event is missing or malformed. Tests subscribe, wait with a timeout and assert the message.