Rails Conf 2013 The Magic Tricks of Testing by Sandi Metz
Why Hacker News recommends it
HN recommends it as an incredible talk whose testing principles apply beyond Ruby.
What it is
Sandi Metz's RailsConf 2013 talk offers practical guidelines for deciding what to test and how, so tests stay cheap and stable. She argues for testing the public interface rather than implementation and using mocks appropriately.
Recommended by 5 HN commenters across 5 different months, 2013 to 2019.
What Hacker News said
Strong rec AlwaysBCoding · 2013-09 · on “Testing code is simple”
What I wish people had told me about testing: * You write tests in accordance with a pattern: 1. Arrange 2. Act 3. Assert 4. Annihilate If you annihilate your test data with configuration options, and you abstract your "arranging" into factories and custom methods, then every test you write should be exactly three lines. When I learned this it gave me a consistent mental framework to think about how to write good tests. * Test the interface not the implementation: This was an eye opening realization about what to test. If you haven't seen it yet, watch Sandi Metz' incredible RailsConf talk - [this video] - it's so good * Stubs: Stubs are exactly like the viruses' that we learned about in biology
Recommends richardjordan · 2014-01 · on “The Failures of "Intro to TDD"”
Shout out for Sandi Metz book POODR, and her Railsconf talk The Magic Tricks of Testing, if you're a rubyist (though the principles hold true for non-ruby OO programmers too). [this video]
Recommends matchmike1313 · 2018-01 · on “Ask HN: How much time do you invest in writing tests?”
I spend about 30% of my time on a new feature writing tests. BTW that is in RoR which the primary language I code in. I would recommend watching this video by Sandi Matz on testing: [this video] . I have used this methodology a lot to determine what I should test.
Recommends teeray · 2018-11 · on “Measuring and Improving Your CI/CD Pipelines”
There are some really fantastic testing resources in the Ruby community. The talk that most influenced my approach to building unit tests (even though I write Go these days) was one of Jim Weirich’s: [LINK] I’ve found that his zero-knowledge approach gives me a suite of tests that have high signal when they fail. Sandi Metz has also spoken extensively on testing, and I particularly like her advice on using mocks in tests appropriately. This talk of hers on the subject comes to mind: [this video]
Recommends jakespracher · 2019-11 · on “Ask HN: Do you write tests before the implementation?”
Not always before, but always eventually and usually once I’m done with “exploration”. Testing done right should be a time saver in the long run! I think many people are turned off by testing and especially unit testing because it ends up being difficult and maintenance is more of a pain than it’s worth. There are many good strategies to make it easier that in my experience have yet to be well adopted: [this video] [LINK]