【发布时间】:2018-10-14 22:23:08
【问题描述】:
我正在尝试将发送电子邮件的代码解耦到一个单独的服务中,而 rabbitMQ 具有服务之间的通信方式。
目前,我有集成测试来测试我们的 HTTP 端点,如下所示:
1. Create fake data in a dockerized mysql container. So that the DB is in the correct state
2. Perform testable action such as: User needs to approve a contract
3. Expect that the `contract.status` is now `approved`
4. Query a local SMTP server (Mailhog) to see if the email is there
5. Expect that email subject/body contains what I'm expecting
现在我计划将消息队列放入其中。我还应该像这样编写集成测试吗?我应该如何编写测试,以便在执行此操作时仍然可以测试是否发送了电子邮件。
【问题讨论】:
标签: testing rabbitmq integration-testing message-queue