personal web log written by izabeera and dryobates

testing coding dojo mocking TDD

Mocking

by dryobates

My coworker asked me to explain him how to use mock library while writing tests. Why to tell him how to use it? Let he gave it a try at Coding Dojo!.

So we get our hand into two of Racing Cars kata. That kata are simple enough so that we don’t need to dig hard into code to find out what it is doing. But there is at least two objects in game so there’s some space for using mocks.

That kata can be done easily without mock library [1] but the purpose of this coding dojo was to learn how to use that library. Because of that I a little broke coding dojo rules (with acceptance of participants) and forced my coworkers to use different methods of patching. That was only to show them that in different cases we can use different approaches.

How did my coworkers cope with mocking? I think they won’t have problem with mocking in their professional job. I hope they won’t overuse it either.

[1]mock http://www.voidspace.org.uk/python/mock/
dryobates
dryobates
Jakub Stolarski. Software engineer. I work professionally as programmer since 2005. Speeding up software development with Test Driven Development, task automation and optimization for performance are things that focus my mind from my early career up to now. If you ask me for my religion: Python, Vim and FreeBSD are my trinity ;) Email: jakub@stolarscy.com

Archive

Tag cloud