No video

If Someone Was Doing Test-Driven Development, How Would You Tell?

  Рет қаралды 1,408

Emily Bache

Emily Bache

Күн бұрын

Can you do TDD with Approval tests? Can it still be TDD even if you don't follow the rules set out by Robert C. Martin? I claim you can!
In this video, I’m asking "If someone were doing TDD, how would you tell?" And I’m doing a demo of the Leap Year Kata show what I mean.
▬ Links ▬▬▬▬▬▬▬▬▬▬
You can find the Leap Year Kata on Sammancoaching.org ➡️ sammancoaching...
Article about the Three Laws of TDD: ➡️ butunclebob.com...
My Guided Learning Hour on TDD including a demo of Leap Years with ordinary unit tests: ➡️ • TDD: What it is & Why ...
If you would like to support my work and get exclusive material, please join my Patreon ➡️ / emilybache
Emily on social media
X (Twitter) ➡️ / emilybache
LinkedIn ➡️ / emilybache
Mastodon ➡️ sw-development...
▬ Video chapters ▬▬▬▬▬▬▬▬▬▬
00:00 - Introduction
00:52 - Emily Explains: TDD with Approvals
02:33 - Demo: Leap Year Kata
13:05 - Is it TDD?

Пікірлер: 16
@gregorriegler
@gregorriegler 9 ай бұрын
The tests are not exactly driving but safeguarding. So I would argue its not TDD. However, it is a good workflow in its own right that has similarities with TDD. The fast feedback loop makes it extremely valuable.
@EmilyBache-tech-coach
@EmilyBache-tech-coach 9 ай бұрын
I like that word 'safeguarding'. I think you make a good point, that the tests don't drive the design in same way.
@svetzal
@svetzal 9 ай бұрын
Hi Emily, It's awesome to see you doing a KZfaq series!! As you walked folks through this, and since you channelled a bit of Bob in there, I was thinking of his Transformation Priority Premise. Your presentation of this kata solves the hard parts by prioritizing which order the tests should go in to have the smoothest progression from no passing through fully passing. A lot of folks go off the rails because they don't really have a sense of in what order they should write the tests. It also made me think of another thing - I friend of mine once reflected my coaching back at me in the most brilliant way - (paraphrasing) "if you are doing TDD, it's harder to test the implementation because it doesn't exist yet, it focuses you on testing across the outcomes." This is another way IMO that approval testing can gain you the same kinds of outcomes as TDD. Anyways, back to TPP, have you thought about test order and some ways to break this down for folks to help them not get trapped into prematurely solving the whole problem.
@EmilyBache-tech-coach
@EmilyBache-tech-coach 9 ай бұрын
Thankyou for your kind words! Yes, the kata description for leap years gives you the test cases in order actually, and you're right - working out how to get an ordered list of test cases given a vague problem description is a crucial skill for TDD. I will definitely have some material on that in this channel at some point.
@troelsirgens-mller9922
@troelsirgens-mller9922 9 ай бұрын
I recently did a talk about this at work, inspired by your videos. While I won’t argue about the definition of TDD, using approval tests this way provides arguably the same benefits. Early feedback on design, enables refactoring and protects against regressions. Where I work we do lots of mathematical modeling, and a typical challenge is that we don’t know the correct output beforehand, so it’s hard to write the test first. However, once we have a new output, we always have some way of validating it, even if it’s just eyeballing a plot. With approval testing, once the output is validated, we approve it and check it in. Rinse and repeat. This enables us to do almost(?) TDD where we previously might not have had any automated tests at all.
@EmilyBache-tech-coach
@EmilyBache-tech-coach 9 ай бұрын
That sounds great. Approval testing is definitely useful in the case you describe - where you can't know the correct output beforehand, but you'll know it when you see it.
@Razpirato
@Razpirato 9 ай бұрын
It's TDDish, because it gives you the same benefits but through a different means. I use this method when the output I want is a string, like LaTeX or Markdown. I have a vague notion of what I want, but I can't write it down concretely. So I use the code to help generate the test case. As you said, it's hard to see the benefit in this example, because the output you're really testing is a boolean but your test is comparing strings.
@EmilyBache-tech-coach
@EmilyBache-tech-coach 9 ай бұрын
Yes this problem isn't really suited to this approach - something with a more interesting output would illustrate it better.
@daverooneyca
@daverooneyca 9 ай бұрын
I've been using TDD since 2000. This is TDD. In the small, it's different from what I learned, which was indeed Bob Martin's "rules". By the time you commit, though, it's identical.
@EmilyBache-tech-coach
@EmilyBache-tech-coach 9 ай бұрын
I'm impressed you've been using TDD for so much of your career, and I'm really happy to hear your opinion. Thankyou!
@shaikazar1729
@shaikazar1729 8 ай бұрын
I got inspired by this and added an approval test to one of my perl script
@EmilyBache-tech-coach
@EmilyBache-tech-coach 8 ай бұрын
Excellent! I use TextTest for testing my python scripts and I think it should work just as well for perl.
@marcoemrich7873
@marcoemrich7873 9 ай бұрын
This is amazing Emily! I agree that this can still be a kind of TDD! You still have the fast feedback loop. And you have the expected value written beforehand in your head. Than you verify if the result matched and approve if yes. I think this qualifies it! Oh, you are from Gothenburg, right? Maybe we can call it the Gothenburg-School of TDD? ;)
@EmilyBache-tech-coach
@EmilyBache-tech-coach 9 ай бұрын
Thanks Marco. I'm glad you see things this way. I'm not sure the world needs a Gothenburg school of TDD though!
@lolo101
@lolo101 9 ай бұрын
It makes me feel uncomfortable that the correctness of your code only relies on you comparing the spec (the sketch) and the test output. In a project I worked on, the spec was a large table of numbers elaborated by a business analyst, and he actually made occasional mistakes Thanks to a robust set of unit tests we (the devs) could point which edge case the analyst had missed. So I would not identify acceptance testing (ATDD or BDD ?) and TDD. Unit testing gives me more confidence because I have a set of tiny tests, each of them validating a single business rule whereas acceptance testing yields a single test (or a smaller group of tests) for all (or many) of them at a time
@EmilyBache-tech-coach
@EmilyBache-tech-coach 9 ай бұрын
I'm happy to hear your unit testing approach has been so successful. If your code is written that way, with tiny units, and you're getting good results then go for it. In the video I showed you could write one approval test that exercises several business rules, and as you point out that could have been multiple smaller tests. Perhaps an advantage of one bigger test is you can get an overview of what's going if several rules interact badly and a bug is hard to pinpoint. I could also have written four smaller approval tests but with such a simple output (a boolean) that would have not been worth it.
I REGRET Not Telling Dave Farley THIS about Approval Testing
16:45
Emily Bache
Рет қаралды 3,2 М.
Start Your TDD Journey with C# in 15 MINUTES
14:55
Gui Ferreira
Рет қаралды 20 М.
Son ❤️ #shorts by Leisi Show
00:41
Leisi Show
Рет қаралды 10 МЛН
Can A Seed Grow In Your Nose? 🤔
00:33
Zack D. Films
Рет қаралды 32 МЛН
WORLD'S SHORTEST WOMAN
00:58
Stokes Twins
Рет қаралды 174 МЛН
ОБЯЗАТЕЛЬНО СОВЕРШАЙТЕ ДОБРО!❤❤❤
00:45
TDD: What it is & Why you Should Care | Guided Learning Hour
22:27
Emily Bache
Рет қаралды 2,2 М.
Test Driven Development Tutorial For Beginners
23:54
Continuous Delivery
Рет қаралды 60 М.
Best Tests for Gilded Rose Kata | Kent Beck’s Desiderata
17:40
Emily Bache
Рет қаралды 2,3 М.
Python TDD Workflow - Unit Testing Code Example for Beginners
25:33
Python Simplified
Рет қаралды 76 М.
Stop Calling Your API a "REST API"
17:42
Amichai Mantinband
Рет қаралды 16 М.
Test driven development (TDD) - Tutorial for Beginners
25:09
Nick Chapsas
Рет қаралды 96 М.
Reduce Method Sprawl with Code Paragraphs | Software Team Learning
25:27
Premature Optimization
12:39
CodeAesthetic
Рет қаралды 786 М.
Everyday Design Improvements in OO Code | Guided Learning Hour
20:39
Son ❤️ #shorts by Leisi Show
00:41
Leisi Show
Рет қаралды 10 МЛН