Search GimmeJob

Type at least 2 characters. Enter also searches by meaning.
QA interview question
Web, API & dataMiddleOccasionalIntegration

What belongs in a contract test for an event-driven integration?

Answer

Validate channel or topic, message schema, required metadata, key or partition semantics, compatibility rules and the business meaning of each event. Exercise producer serialization and consumer deserialization with versioned examples, including optional and unknown fields. The contract should not pretend to prove broker delivery, ordering or end-to-end side effects; cover those with integration and system tests.

Strong answer includes

  • covers message semantics and metadata, not only JSON shape
  • tests producer and consumer compatibility
  • separates contract evidence from broker and workflow behavior

Practical example

A contract test confirms both the producer and consumer agree that an OrderShipped event's trackingNumber field is optional and may be absent for in-store pickups; without that explicit case in the contract, the consumer's deserializer would have thrown on the very first pickup order once it hit production.

#event-driven#contract-testing#api-qa#sdet

Sources

AsyncAPI Specification 3.0.0AsyncAPI Initiative · Message-driven API channels, operations, messages, schemas and bindingsOpenAPI Specification 3.2.0OpenAPI Initiative · API contracts, schemas and operation descriptions