代码之家  ›  专栏  ›  技术社区  ›  Luke Xu

我应该在MQ/服务体系结构中测试整个业务流吗?

  •  1
  • Luke Xu  · 技术社区  · 7 年前

    目前,我进行了集成测试,测试我们的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
    

    1 回复  |  直到 7 年前
        1
  •  0
  •   JGK    7 年前

    如果整个解决方案由您负责,那么您肯定应该为整个解决方案编写集成测试。

    作为 Martin Fowler 国家:

    集成测试确定独立开发的软件单元在相互连接时是否正常工作。

    编写测试取决于具体的实现。我认为您必须创建测试数据并执行操作(步骤1到3),然后检查结果,而不管是否存在MQ。