Skip to content
RED SAGSkills
hardAutomation Test Engineer interview question

How do you design automated tests for an event-driven microservices system where services talk through a message broker?

What the interviewer wants to hear

  • Unit test handlers with in-memory events
  • Component tests with a real broker in containers
  • Contract tests or schema registry for event shapes
  • Poll with timeouts for async outcomes, use correlation ids
  • Test retries, duplicates, ordering and dead-letter queues

Model answer

I test at several levels. Each event handler gets unit tests with in-memory events, covering business rules. Then component tests run each service with a real broker, like Kafka or RabbitMQ, started in containers with Testcontainers: publish an event, then poll with a timeout until the expected side effect appears, never fixed sleeps. Event shapes are protected with contract tests or a schema registry with compatibility rules, so a producer cannot break consumers silently. Event-driven systems fail in special ways, so I deliberately test duplicate delivery to prove handlers are idempotent, out-of-order events, consumer crashes and retries, and that poison messages land in the dead-letter queue. A few end-to-end tests cover critical flows using correlation ids so I can trace one order through every service and debug failures from logs.

Can you answer it under time pressure?

Take a timed hard round and get scored on every answer.

Start mock interview

More hard Automation Test Engineer questions