Rails Conf 2013 The Magic Tricks of Testing by Sandi Metz

Channel:Confreaks · Length:32:22 · Published:2013-05-22 · Views:144666

Watch on YouTube

Summary

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.

Why HN recommends it

HN recommends it as an incredible talk whose testing principles apply beyond Ruby.

watch Sandi Metz' incredible RailsConf talk — HN, 2013

Python, Ruby & scripting languages · Software architecture & design · Testing, debugging & developer tools

Subtitles (excerpt)

[Applause] [Music] [Applause] so if you're coming to the magic trick talk I have a survey before my Talk starts right so I don't use my a lot of time for this so please feel free to talk among yourselves I'm going to ask you a question and ask for an answer by a show of hands and so this is what the question is going to be what percent okay and it's not about your code so you don't have a conflict of interest you're not going to out yourself here in front of your teammates the question is what percent of the code that you see is tested at some person some well is is the code that you see tested at 100% 80% 60% 40% 20% or 0% right so I want I want you to tell me about the code that you see how well it's tested so if the code that you see is 100% tested raise your hand you are lucky people all right 80% if the code you see is 80% tested all right 60 40 20 zero so if you're if you were in the 50% or less category raise your hand all right so now the Talk starts we are the people who Embrace testing we're the clan that drank the Kool-Aid this is our public persona but you don't have to look around the room very far to see that many people perfectly legitimate completely respectable card carrying members of our community say

On Hacker News

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 … — AlwaysBCoding, 2013-09
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 ad… — jakespracher, 2019-11
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 advic… — teeray, 2018-11
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: [VIDEO] . I have used this methodology a lot to determine what I should test. — matchmike1313, 2018-01
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). [VIDEO] — richardjordan, 2014-01

Related videos