Upgrade to Pro — share decks privately, control downloads, hide ads and more …

Start TDDing in 5 minutes

Start TDDing in 5 minutes

TDD is awesome, but can be scary. Learn how to start practicing it in 5 minutes by fixing bugs, so we can kill two birds with one stone!

Matheus Richard

October 19, 2021
Tweet

More Decks by Matheus Richard

Other Decks in Programming

Transcript

  1. Start TDDing in
    5 minutes

    View Slide

  2. About me
    Matheus Richard
    module Matheus
    def self.working_at() =
    "thoughtbot - Software Engineer"
    def self.blogging_at() =
    "https://matheusrich.com"
    def self.github_profile() =
    "@MatheusRich"
    def self.twitter() =
    "@MatheusRich"
    def self.other_hobbies() =
    %w[Gaming Playing\ guitar Skating]
    def self.studying() =
    %w[Crystal Rust]
    end

    View Slide

  3. TDD is awesome!
    😎

    View Slide

  4. TDD is awesome!
    But can be scary.
    😎
    😰

    View Slide

  5. Oh, no!
    🐛 You got a bug in production!
    🐛

    View Slide

  6. 💸 The famous Billion Dollar Mistake

    View Slide

  7. View Slide

  8. Let’s start with a test
    It has to reproduce the same error we saw
    earlier

    View Slide

  9. View Slide

  10. We run our test and...

    View Slide

  11. 💥 BOOM!

    View Slide

  12. Now, make it pass!

    View Slide

  13. View Slide

  14. 🤞 We run our test and...

    View Slide

  15. ✔ We’re green!

    View Slide

  16. 🤔 We TDDed, so…?

    View Slide

  17. 🐛
    We’ve fixed the bug
    💥

    View Slide

  18. 👍 We’ve added a test
    confirming our fix!

    View Slide

  19. TL;DR
    1. 🐛 Identify the bug;

    View Slide

  20. TL;DR
    1. 🐛 Identify the bug;
    2. ❌ Write a test that reproduces the error;

    View Slide

  21. TL;DR
    1. 🐛 Identify the bug;
    2. ❌ Write a test that reproduces the error;
    3. ✨ Fix the bug;

    View Slide

  22. TL;DR
    1. 🐛 Identify the bug;
    2. ❌ Write a test that reproduces the error;
    3. ✨ Fix the bug;
    4. ✔ Watch the test pass.

    View Slide

  23. That’s it!
    ➜ ~ Question.any?
    @MatheusRich www.matheusrich.com

    View Slide