An experimental and possibly pointless gem, for the curious

12 views
Skip to first unread message

Rob Old

unread,
Mar 20, 2020, 2:41:43 AM3/20/20
to nwrug-...@googlegroups.com
Hi everyone,

As the meeting wasn't on tonight I thought some of you might have been desperately craving some sort of extracurricular ruby, so I hope no-one minds me sharing version 0.1.1 of my first ruby gem: 

https://github.com/robwold/compact


It came about as I watched Joe Rainsberger's talk 'Integration tests are a scam' (https://www.infoq.com/presentations/integration-tests-scam/) and became interested in the thinking outlined there. (Gary Bernhardt discusses some advantages of this approach in his well-known 'Boundaries' (https://www.destroyallsoftware.com/talks/boundaries) talk.) The TL;DR:

  1. If you want to prove the 'basic correctness' of your code with true unit tests, then when you use a test double (mock/stub) in a 'collaboration' test, write a 'contract' test that some class in your code really behaves the way you've said your mock does.
  2. This approach is actually more likely to throughly test the basic correctness of your code than the corresponding integration tests, because integration tests are hard to write and slow to run, so nobody writes enough of them to actually exercise all the possible paths of execution in your code.

He said it would be nice to have a tool that helps you automate this correspondence. Sandi Metz mentioned some tools intended to help with this in her talk 'The magic tricks of testing' (https://www.youtube.com/watch?v=URSWYvyc42M), but they seem to have largely fallen by the wayside. Have a look at the README if you're interested in how I'm trying to approach the problem. It'd be great if anyone who's interested in this approach to testing had any feedback that could help mould this into something that is actually useful.

Cheers,
Rob
Reply all
Reply to author
Forward
0 new messages