mardi 28 juillet 2020

How to TDD e.g. SQL

I've finally gotten around to actually reading Kent Beck's book on TDD. Sadly, one of the things I was hoping to learn, I didn't.

I often get stuck on stuff that calls out to external systems. Page 144 has a test that includes an SQL statement... But where did that SQL come from?

For me, I often end up in this cycle where I sort of have the test, but don't know what the SQL will end up being. At that point, I feel compelled to write the production code first, iteratively working out what the SQL needs to be, and what exactly the response looks like.

Only THEN can I finish writing my test, but that's not quite TDD, is it?

My problem is rarely actually SQL (currently, it's interactions with libvirt), but since that's the example from the book, let's use that.

What am I missing? Can I actually do TDD with something like this?

Aucun commentaire:

Enregistrer un commentaire