Upgrade to Pro — share decks privately, control downloads, hide ads and more …

Making a mockery of web services

Making a mockery of web services

With the help of WireMock (http://wiremock.org/) we will explore how to create reliable and repeatable integration/system tests for an application that depends on an external web service or HTTP-based API.

Originally presented as a lightning talk at the Manchester Java Community event held at AutoTrader's offices on 20th October 2016.

51a762e5e356bc1063f9a2e132948ef3?s=128

Nick Ebbitt

October 20, 2016
Tweet

Transcript

  1. MAKING A MOCKERY OF WEB SERVICES Manchester Java Community –

    20th October 2016 Nick Ebbitt @nickebbitt
  2. THE PROBLEM Cloud based mobile platform Continuous Delivery pipeline Dependency

    on “backend” web service Automated tests…?
  3. DEFINE: MOCK

  4. DEFINE: MOCK In software engineering mocks are… "…special case objects

    that mimic real objects for testing." http://martinfowler.com/articles/mocksArentStubs.html?
  5. WHY USE MOCKS? Control interactions Deterministic & repeatable tests Model

    scenarios Acceptance criteria
  6. WHEN TO MOCK?

  7. MOCKING WEB SERVICES

  8. INTRODUCING WIREMOCK… Created by Tom Akehurstin 2011 Version 2.1.12 http://wiremock.org/

    https://github.com/tomakehurst/wiremock
  9. DEPLOYMENT

  10. KEY FEATURES Stubbing Verifying Proxy Record and Playback Simulating faults

    Stateful behaviour
  11. DEMO

  12. CONCLUSION Reduce dependency on “backend” service Improve testability Improve quality

    Increase productivity
  13. THANK YOU @nickebbitt https://github.com/nickebbitt/wiremock-examples