MAKING A MOCKERY OF WEB SERVICES
Manchester Java Community – 20th October 2016
Nick Ebbitt
@nickebbitt
Slide 2
Slide 2 text
THE PROBLEM
Cloud based mobile platform
Continuous Delivery pipeline
Dependency on “backend” web service
Automated tests…?
Slide 3
Slide 3 text
DEFINE: MOCK
Slide 4
Slide 4 text
DEFINE: MOCK
In software engineering mocks are…
"…special case objects that mimic real objects for testing."
http://martinfowler.com/articles/mocksArentStubs.html?
Slide 5
Slide 5 text
WHY USE MOCKS?
Control interactions
Deterministic & repeatable tests
Model scenarios
Acceptance criteria
Slide 6
Slide 6 text
WHEN TO MOCK?
Slide 7
Slide 7 text
MOCKING WEB SERVICES
Slide 8
Slide 8 text
INTRODUCING WIREMOCK…
Created by Tom Akehurstin 2011
Version 2.1.12
http://wiremock.org/
https://github.com/tomakehurst/wiremock
Slide 9
Slide 9 text
DEPLOYMENT
Slide 10
Slide 10 text
KEY FEATURES
Stubbing
Verifying
Proxy
Record and Playback
Simulating faults
Stateful behaviour
Slide 11
Slide 11 text
DEMO
Slide 12
Slide 12 text
CONCLUSION
Reduce dependency on “backend” service
Improve testability
Improve quality
Increase productivity
Slide 13
Slide 13 text
THANK YOU
@nickebbitt
https://github.com/nickebbitt/wiremock-examples