23 October 2015

What I learnt from 006: Mock services,Not objects

I went to a talk "Mock Services, not Objects" presented by Tom Akehurst who is an author of WireMock.
Event was organized by London Java Community (LJC). 

WireMock:
"WireMock is a flexible library for stubbing and mocking web services. Unlike general purpose mocking tools it works by creating an actual HTTP server that your code under test can connect to as it would a real web service. It supports HTTP response stubbing, request verification, proxy/intercept, record/playback of stubs and fault injection, and can be used from within a unit test or deployed into a test environment." Source: http://wiremock.org

Tom Akehurst:
"Over the last decade or so I’ve been a developer, app support lead, scrum master and architect. I’m a strong advocate of agile, DevOps and Continuous Delivery practices, and am usually focussed on improving team performance and building operable, sustainable systems." Source: http://www.tomakehurst.com/about/
Rob Elliot is a developer who works with Tom for over decade. I don't know more about him . (Sorry :( )

Talk starts from ...fire alarm , where ...automatic system said "there is a fire alarm activated in ... (silent)" . Yeap, it didn't say where is fire. Luckily , a few minutes later we had an another announcement "There is no fire.Everything is OK. It is security guard".

Tom talked about motivations behind WireMock (like architecture changing from monolith to x amount of smaller services ,  team structure changed to many small teams and so on)
 and how he and other users used his tool on daily basis. He explains what features are useful and when use them and where to not use them. It talks about a few useful design patterns in tests.  Rob did quick live code demo where he shows an example of how WireMock works in practice . I really like it this demo as it shows a high level picture of how things works in practices. Whole talk and demo was nice , informative and simple. It was a very useful talk for people who are interesting in testing.

What I learnt :
  • What is WireMock and why it can be useful . My favourite functionality were record/playback feature , that can come handy in many tests, it can proxy network so it allows you test application against various cock-ups caused by network issues (failures and faults).  It is useful in  stubbing and verification.
  • WireMock is useful tool for test application behaviour when network causes problem.
  • Another proof why Builder pattern is extremely useful  for create flexible data for test. It seems  almost mandatory pattern when you write tests. For example you can Generate test data via builders on setup.
  • Data Randomness is useful as it helps detected edge and unexpected cases.
  • Documentation for WireMock is an amazing . It is nice balance of quick information of what feature does and code example .
Authors mentioned few tools:
  • Sham- test data generation library
  • Fastly.com is a Fastly's real-time CDN (A content delivery network (CDN) is a system of distributed servers (network) that deliver webpages and other Web content to a user based on the geographic locations of the user, the origin of the webpage and a content delivery server. Source: www.webopedia.com/TERM/C/CDN.html )

Networking after Meetup was useful ,because I have opportunity to talk about pair programming and various stuff about testing.

WireMock can be find here : http://wiremock.org

More about LJC can be found here: http://www.meetup.com/Londonjavacommunity/