Testing External Services

There seems to have been a lot of talk around me lately in relation to “dev boxes” and “testing on staging”.

After unsuccessfully trying to convince folks of why I think this is a bad idea from both an engineering and business perspective I decided it was time to talk code.

In this repository I am hoping to show:

  • How an external service calls can be properly encapsulated
  • How different tests can be used to achieve different outcomes:
    • Testing only the local package code in complete isolation from the external service
    • Testing the external service fulfils expectations
    • Testing the local package code handles external service failures (without needing to orchestrate the external service)
  • How all of the above test types can be easily automated in order to prevent regression (for your service and the external service)
  • How providing mocks from a package can help the users of the package test how their code interacts with your package

Enjoy!



Loading Facebook Comments ...