Coding Katas are small problems from a known domain, with the objective of practise basic programming elements and TDD.
Katayunos are the combination of “Coding Katas” and “Desayunos” (which means breakfast in Spanish). It consists on sitting in pairs, in front of a laptop, choose one of the available katas and programming language and have breakfast while working on the given problem practising TDD and thinking about the best approach to solve the problem.
Well, this weekend I’ve been involved on my first Katayuno experience, at Softonic offices. The practised kata was KataBankOCR, where we are given with an ASCI numbers and we have to transform that into a String, not very complex but it had an interesting point into the test.
At the first iteration, we were tackling the problem wrong. We spend some time trying to validate the input and where a bit slow because our strict state (RED – GREEN – REFACTOR) of TDD work-flow. At the end of the first iteration we were discussing about how much we have to cover with the test. On that problem, we can’t test much more than “for a given input” which is the “expected output”.
What you think about testing private methods?
Obviously you can’t test private methods straight away, but you can work around that. However, we agree that doing that is not a good test case. The main reason is that we want to test the problem, not our concrete solution about the problem. The point is that at the end of the exercise, we could switch tests and our code shall keep passing both tests.