• english
  • polski
  • Speaker: Szczepan Faber

    Topic of presentation: Enter the Test Spy (or: good bye mocks)

    Language: Polish

    Szczepan Faber enjoys living in Krakow, where he crafts software for Sabre. Mocking frameworks are one of many things he does not understand in software development. So he wrote Mockito, a spying framework which suppose to bring simplicity and common sense to testing complex Java applications. Szczepan’s team mates say he is an annoying wise guy so stay away from him (unless you get the joke and you are OK with his weird sense of humour).

    Abstract: I’ve been using mocks for years with a hope of writing better code, better tests. Thanks to mocks I was able to test-drive my classes easily by mocking out expensive dependencies. I was able to discover interfaces from my tests. But there was a gotcha. At some point I realized that my tests were brittle. Also, my tests were less readable than tests without mocks. Finally, my tests were less readable then tests with crude hand stubs. Therefore I re-evaluated mocking and wrote spying framework called Mockito.

    My presentation tries to compare spying approach with mocking. I dare to say that using Test Spies results in cleaner code. I dare to say that working with Test Spies is more natural and less invasive. To be fair, I show when a Mock Object can actually be better then the Test Spy. Although I talk about mocking and spying in general, there is some Java code lurking on the slides.

    I gave similar talk this year at Agile 2008 in Toronto. I hope to promote Test Spy pattern in the world overtaken by Mock Objects for too long.

    I think it’s essential for Java developers to know the latest tools for doing their job well. Also, I think it’s very interesting to know the historical context – motivations and design decisions that shaped the way we do testing these days.

    Proidea