Which mock library do you prefer?

Lacrima lacrima.maxim at gmail.com
Wed Feb 17 08:25:03 EST 2010


On Feb 16, 7:38 pm, Phlip <phlip2... at gmail.com> wrote:
>
> This paper _almost_ gets the idea:http://www.netobjectives.com/download/Code%20Qualities%20and%20Practi...
>
>
> Do you run your tests after the fewest possible edits? Such as 1-3
> lines of code?
>

Hi!
I run my tests all the time (they almost replaced debugger in my IDE).
But there are times, when I can't just run tests after 1-3 lines of
code.
For example, I am developing an application that talks to some web
service. One of methods of a class, which implements API for a given
web service, should parse xml response from web service. At first, I
hardcoded returned values, so that they looked like already parsed.
But further, additional tests forced me to actually operate with
sample xml data instead of hardcoded values. So I created sample xml
file that resembled response from server. And after that I can't just
write 1-3 lines between each test. Because I need to read() the file
and sort it out in a loop (at least 6-9 lines of code for small xml
file). And only after this procedure I run my tests with the hope that
they all pass.
Maybe it's not proper TDD, but I can't figure out how to reduce period
between running tests in a case above.



More information about the Python-list mailing list