Skip to content
This repository has been archived by the owner on Nov 13, 2023. It is now read-only.

Latest commit

 

History

History
34 lines (23 loc) · 871 Bytes

verified_fakes_of_web_services.md

File metadata and controls

34 lines (23 loc) · 871 Bytes

Verified fakes of Web Services

Speaker: Adam Dangoor (@adamdangoor)

Slides: TODO

Video: https://www.youtube.com/watch?v=3H0d9lp05vA

  • Testing against a live API causes problems:

    • Slow.
    • Costly.
    • ...
  • Can we test that our code is calling the API correctly, even when the API is down?

    • Yes, with mocks.
  • pip install requests-mock

  • pytest's fixture context managers are useful here.

  • Problems with mocking:

    • Human error.
    • API changes lead to outdated mocks.
  • Writing a mock:

    • A verified fake is a mock that can pass a test suite that can be run against either a real API.
    • Parameterising tests (see slides for details).
    • The tests now tell us when the API has breaking changes.
      • Use a scheduled test suite to test this periodically.
  • Shipping a verified fake will add value to your software.