TRANSCRIPT 🔗
WEBVTT
00:00:00.000 --> 00:00:10.000
Welcome to another episode of Runtime Arguments, the podcast where we talk about tech things. Uh, and here today with me is my buddy Wolf.
00:00:10.000 --> 00:00:18.000
Hey, everybody. It's, uh… maybe I shouldn't say hey, everybody, because I think I always say that, don't I? Instead, why don't I say…
00:00:16.000 --> 00:00:18.000
It's fine to say that.
00:00:18.000 --> 00:00:21.000
Hello all listeners.
00:00:22.000 --> 00:00:25.000
Good morning good afternoon and good evening.
00:00:25.000 --> 00:00:37.000
Right, right. And, uh, and I didn't mention my name. I'm Jim McQuillan, as always. Uh, this is episode number 34, our 35th episode, and today we're gonna talk about testing.
00:00:37.000 --> 00:00:44.000
And, uh, this… this should be fun, because test… uh, Wolf tests, and I don't, and we're gonna talk all about that.
00:00:44.000 --> 00:00:50.000
Uh, should be fun. Um… let's see… How was your week, Wolf?
00:00:51.000 --> 00:00:52.000
Umm.
00:00:52.000 --> 00:00:56.000
Pretty boring, actually. Uh…
00:00:54.000 --> 00:00:55.000
Hey.
00:00:55.000 --> 00:00:57.000
Is that good?
00:00:56.000 --> 00:01:09.000
There were places, as usual, where I learned I was an idiot. Every day, in every way, I learn more and more about the things I don't even know I don't know yet.
00:01:09.000 --> 00:01:21.000
So, that's a thing. Uh, and I did experience some annoying issues. There were a couple of tailscale updates, uh, that I experienced.
00:01:20.000 --> 00:01:21.000
Yeah.
00:01:22.000 --> 00:01:35.000
Um… And I don't know exactly what I've done to ***** up my world, but, um… I have Tailscale installed via the Homebrew cask.
00:01:35.000 --> 00:01:45.000
Maybe that's not the best way, but I have it set up so that it, um… Tailscale updates itself.
00:01:45.000 --> 00:02:08.000
Um, not, like… Homebrew update upgrade? That, that doesn't do the thing. Uh… But it's not quite set to totally update itself, it says hey I have updates you want me to update and then I push a button and that button says why don't you go ahead and do everything it takes to upgrade except.
00:02:08.000 --> 00:02:10.000
actually work.
00:02:10.000 --> 00:02:17.000
Stop at the place where you were gonna trade out your, um, system networking extension.
00:02:17.000 --> 00:02:24.000
and tell me you can't go any further than that, and make it be that I don't have any network at all.
00:02:24.000 --> 00:02:28.000
That's how I have Tailscale installed.
00:02:28.000 --> 00:02:37.000
And to get past that, and believe me, I've tried everything except a different installation mechanism.
00:02:37.000 --> 00:02:43.000
But, you know, rebooting, reinstalling, blah blah blah. Here's the thing that works for me.
00:02:43.000 --> 00:02:47.000
I reboot into system recovery mode.
00:02:48.000 --> 00:02:50.000
And go through all that bullcrap.
00:02:50.000 --> 00:02:53.000
I get to the terminal.
00:02:53.000 --> 00:02:58.000
Uh, there, and I disable SIP.
00:02:58.000 --> 00:03:02.000
That's System Integrity Protection.
00:03:02.000 --> 00:03:04.000
That's a thing you don't want to do.
00:03:04.000 --> 00:03:05.000
Right.
00:03:04.000 --> 00:03:05.000
Um.
00:03:05.000 --> 00:03:09.000
Right. And then you have to reboot.
00:03:09.000 --> 00:03:14.000
And then you're in a world with no SIP.
00:03:14.000 --> 00:03:22.000
Which is bad, it's like those super cool power saws that, uh, you know, table saws that stop if they touch flesh.
00:03:22.000 --> 00:03:26.000
Um, it's like NOT having that.
00:03:27.000 --> 00:03:30.000
I don't want to not have that.
00:03:30.000 --> 00:03:41.000
Uh, and then I ask… it could be as simple, then, as asking, uh, Tailscale to do the upgrade again.
00:03:41.000 --> 00:03:51.000
Or, it might be that I have to go in and remove the extension by hand, and then start Tailscale, and it will automatically install the extension.
00:03:51.000 --> 00:03:56.000
Anyway, once it resolves that problem, which is fairly easy with no SIP.
00:03:56.000 --> 00:03:58.000
Um, yeah.
00:03:58.000 --> 00:04:09.000
Then I have to reboot into recovery mode, uh, do all the password ***** get the terminal up, and then re-enable SIP.
00:04:09.000 --> 00:04:19.000
Uh, and then reboot again, and now I'm back to normal. So that whole thing takes 15 minutes, or maybe 20 minutes. Um, it's annoying.
00:04:17.000 --> 00:04:20.000
All right, all right, so.
00:04:20.000 --> 00:04:34.000
I just searched, recommended way to install Tailscale on macOS. And one of the guys, I've seen him a lot, from Tailscale, he says the recommended way to do it is download the standalone.pkg file.
00:04:25.000 --> 00:04:27.000
Uh-huh.
00:04:34.000 --> 00:04:47.000
Uh, and install it. Uh, it… it does everything you need it to do, and there… he says, yeah, there are other ways to do it, which apparently you're doing one of the other ways, but why not do it the recommended way?
00:04:47.000 --> 00:04:55.000
Is there something you're… you're not getting by… by doing that? Is there something you hope to achieve by doing it the brew-cask way?
00:04:56.000 --> 00:04:58.000
A.
00:04:58.000 --> 00:05:17.000
No, I… there were a bunch of different ways to install it, and, um… I… prefer to install things either using cargo or using brew because then.
00:05:13.000 --> 00:05:14.000
Mmhm.
00:05:17.000 --> 00:05:26.000
um, I'm automatically plugged into updates. Whether that thing knows how to update itself or not, no matter what it is.
00:05:24.000 --> 00:05:27.000
Okay.
00:05:26.000 --> 00:05:38.000
It's gonna be that at least once a week, um… I'm gonna, by hand, make sure that it updates, and if it's the kind of thing that updates itself, oh, that's great too.
00:05:38.000 --> 00:05:43.000
So, that's just my default choice when given choices.
00:05:41.000 --> 00:05:45.000
Okay, so that's… that's one of the differences between me and you.
00:05:43.000 --> 00:05:45.000
But if this one's better…
00:05:45.000 --> 00:05:54.000
That's, uh, you prefer to use
Load full transcript
brew or, uh, or, or, uh, cargo or something. I prefer to use the recommended method.
00:05:54.000 --> 00:05:59.000
And you know what? I don't have a problem updating Tailscale. It just updates.
00:05:57.000 --> 00:06:01.000
Okay, so you made it sound like.
00:06:01.000 --> 00:06:03.000
The things I said?
00:06:03.000 --> 00:06:11.000
are never the recommended method, but in fact, brew is often the recommended method.
00:06:05.000 --> 00:06:09.000
No, in this case.
00:06:10.000 --> 00:06:25.000
And I do install a lot of stuff with Brew, and I'm getting much more used to it, and I keep things updated, and I really like how it works. But, you know, when I went to install Tailscale, I said, how do I install it? And there were the instructions, so I followed it.
00:06:25.000 --> 00:06:36.000
And I believe Brew was there as well, but I chose the recommended way, or the first way I saw. And I just don't have a problem. So, that's my recommendation to you. Uninstall it.
00:06:36.000 --> 00:06:41.000
from Brew and try it the other way and see if that doesn't solve your problem.
00:06:41.000 --> 00:06:44.000
I am going to do that. That is my plan.
00:06:42.000 --> 00:06:46.000
And if it doesn't help, well, hey, sorry.
00:06:45.000 --> 00:06:56.000
It can't be worse! I mean, in all ways, in all ways, I love Tailscale.
00:06:47.000 --> 00:06:55.000
Oops. Well, it doesn't seem like it. It doesn't seem like it could be worse, yeah.
00:06:56.000 --> 00:06:58.000
Yeah, yeah.
00:06:56.000 --> 00:07:04.000
This one facet is a point of friction for me, and I need to fix it, and maybe this will.
00:07:03.000 --> 00:07:06.000
Uh, yeah, maybe.
00:07:06.000 --> 00:07:08.000
How about you? How was your week?
00:07:06.000 --> 00:07:19.000
So I, um… I, uh… it's been a good week, busy as usual, I'm enjoying what I'm doing, everything is great. I finished reading, this was last week, I finished reading The Martian from Andy Weir.
00:07:19.000 --> 00:07:35.000
And, you know, there's the movie with Matt Damon, and it's a great movie. The book… it's probably my favorite book ever that I've ever read. It just… I enjoyed it so much, and I'm sad that it's over. You know, it's one of those kinds of books.
00:07:28.000 --> 00:07:30.000
Really?
00:07:33.000 --> 00:07:36.000
I do know.
00:07:35.000 --> 00:07:48.000
Because he's… you know, Andy Weir is a… he was a software developer, and he started writing this book. It's his first book. He started writing the book chapter by chapter, releasing them online for free.
00:07:48.000 --> 00:08:04.000
And people were reading it, and when he got all done, somebody said, you should talk to a publisher and get it published. And so he did, you know, published into a real book that you could buy, and then, you know, Hollywood came calling, and they made this fantastic movie.
00:08:04.000 --> 00:08:19.000
I just really, really enjoyed the book, and now I have to go back and watch the movie again, because I know there's stuff I missed in the movie
that I didn't understand what was happening. And now, you know, the books are always better, right? They're always much more detailed. And I just really.
00:08:19.000 --> 00:08:35.000
I really enjoyed it. Uh, I also read, uh, uh, uh, two months ago, I read Project Hail Mary. That's another one of his books that got turned into a movie starring Ryan Gosling, and that was a great movie, and the book was fantastic. And, uh, here I am.
00:08:35.000 --> 00:08:51.000
I'm stumping for Andy Weir. I read his book, Artemis. It's about a moon base where there are… it's a whole colony of people living there, and that was a great book. In fact, that got optioned into a TV show back around COVID time.
00:08:51.000 --> 00:08:58.000
Uh, so it looked like it was gonna become a series, and then it didn't, I think, because COVID kind of wrecked everything. Kind of wrecked the world.
00:08:58.000 --> 00:09:11.000
Um, but yeah, if you're looking for a book, uh, I'm not that much into sci-fi books, but if you're looking for a book, uh, The Martian is a joy to read. I really, really loved it.
00:09:11.000 --> 00:09:15.000
Um, so yeah, and like I said, I'm sad now 'cause I'm done. Yeah.
00:09:17.000 --> 00:09:28.000
But, uh, you know, I've, uh, we don't have any feedback from our, you know, our last episode was, uh, Pearl Refuses to Die, and I sort of expected some people would have some comments about it.
00:09:28.000 --> 00:09:32.000
But, um, um, it, it, it.
00:09:29.000 --> 00:09:32.000
Number one of which would be.
00:09:32.000 --> 00:09:34.000
What's Pearl?
00:09:34.000 --> 00:09:40.000
Yeah. Pearl refuses to die. I thought it was dead.
00:09:40.000 --> 00:09:51.000
No, I love Perl. Uh, I use it all the time. But, uh, check out that, that last episode if you, if you want to hear our thoughts on, on, our real thoughts on Perl.
00:09:51.000 --> 00:10:05.000
Um, but I do have some newsworthy stuff, I think. Yeah, yeah, you share it all the time. I've got some newsworthy stuff. A couple of things. Uh, Sea Kermit. Did you ever use Sea Kermit, Wolf?
00:09:52.000 --> 00:09:56.000
No, you always hear my real thoughts.
00:10:06.000 --> 00:10:10.000
I used Kermit. Is C Kermit something special?
00:10:08.000 --> 00:10:15.000
Uh, it's, it's, it's, uh, well, I, I think it's all the same thing. It came from Columbia University.
00:10:13.000 --> 00:10:19.000
I mean Kermit is the protocol, maybe see Kermit is the tool.
00:10:16.000 --> 00:10:18.000
Yes. Yeah.
00:10:18.000 --> 00:10:46.000
Yeah, the, the, the software, the open source project, in fact, it was an open source project before open source was a term. Um, it, uh, they released… A new version, their first new version in 11 years. Kermit was C. Kermit was written by Columbia people at Columbia University, and in 2011, Columbia canceled that project. I think they just didn't see a need for it anymore.
00:10:46.000 --> 00:10:56.000
So, uh, they kind of spun off the people that were doing the work. They spun off into their own open source project. And I'll include the link to the project in the show notes.
00:10:56.000 --> 00:11:04.000
And, uh, this one's kind of interesting for me, because years ago, I'm talking 1993.
00:11:04.000 --> 00:11:22.000
I was working on a system. The, the primary system we were using was a, uh, Texas Instruments, uh, an operating, the operating system was called DX10. It was a business-type operating system, and it worked. It ran COBOL. Um, but I, uh, at that time, we were also.
00:11:22.000 --> 00:11:39.000
porting our software to SEO Unix. Well, first we went to Xenix, then Unix, and of course then we went to Linux. But at that time in 93, we were still heavily involved in SEO Unix and I needed to get data from a, from the DX 10 system to a, uh, Unix system.
00:11:39.000 --> 00:11:55.000
And neither system had networking. I mean, of course, you could do networking on Unix, but at that time, you had to pay a lot of money to do networking. And the DX10 system did not have networking. There was no, uh, Ethernet card. Uh, so I needed to get the data from one machine to another, totally different.
00:11:55.000 --> 00:11:58.000
Systems, totally different operating system.
00:11:58.000 --> 00:12:06.000
So, I wrote a terminal emulator, where I could log in from the Unix system into the DX10 system.
00:12:06.000 --> 00:12:19.000
And so now I can sit at my desk with one terminal and talk both Unix and DXN, and life was good. And then I thought, why don't I add file transfer to this little terminal emulator? So I did some research, and I found Kermit.
00:12:19.000 --> 00:12:25.000
And there was a Kermit client for Unix, but certainly nothing for DX10.
00:12:25.000 --> 00:12:31.000
So I wrote my own, uh, uh, Kermit.
00:12:31.000 --> 00:12:33.000
protocol program.
00:12:33.000 --> 00:12:43.000
in assembly language on DX10. And it was very, very minimal. I could download a file, or, you know, I could pull a file from that machine.
00:12:41.000 --> 00:12:44.000
Did did you have other choices?
00:12:44.000 --> 00:12:48.000
For like implementation language.
00:12:46.000 --> 00:12:48.000
Like what?
00:12:48.000 --> 00:12:58.000
Like, what? No, that pro- that- that system, uh, okay, the languages that system supported were COBOL, Pascal, and Assembly.
00:12:58.000 --> 00:13:01.000
And we did not have… we…
00:12:58.000 --> 00:13:02.000
Okay, so you could have written this in Pascal.
00:13:01.000 --> 00:13:05.000
We did not have a Pascal compiler.
00:13:05.000 --> 00:13:08.000
Oh, so you couldn't write it in Pascal.
00:13:05.000 --> 00:13:14.000
I think that would have cost, like, $10,000. So we did not have it. The system supported it, we just didn't have the compiler. So my choice then was COBOL.
00:13:14.000 --> 00:13:19.000
or assembly. And I did assembly and, and.
00:13:17.000 --> 00:13:19.000
So your choice was assembly.
00:13:19.000 --> 00:13:31.000
Yeah, it wasn't even a choice, the language I use. But I implemented, uh, the barest of Kermit
protocol parts that I needed.
00:13:31.000 --> 00:13:46.000
to pull files off that machine. And, uh, and that's what allowed us to take data from that machine and put it on a Unix machine and start giving our customers Unix. And, uh, so I had forgotten all about Kermit. It completely wiped from my memory.
00:13:46.000 --> 00:14:00.000
And then I saw this announcement that version 11 was released. I thought, that's pretty cool. I went, poked around the website, and I'll include the link in the show notes. So that was pretty neat. The other thing is Pandoc. Do you ever use Pandoc?
00:13:59.000 --> 00:14:07.000
Oh my god, do I use Pandoc. It's in my daily toolbox. I guess I don't use it every day, but…
00:14:01.000 --> 00:14:05.000
I think you convinced me to use it.
00:14:05.000 --> 00:14:06.000
All right.
00:14:06.000 --> 00:14:22.000
Yeah, I've got some stuff out there in Pandoc and I know our buddy Scotty, he uses Pandoc and it's out there. Anyway, they just celebrated their 20th anniversary on August 3rd. So I thought that was kind of neat. I thought I'd mention it.
00:14:22.000 --> 00:14:27.000
Pandoc is a tool. Tell us what Pandoc is for since you use it all the time.
00:14:27.000 --> 00:14:44.000
Pandoc is awesome, and it solves the n squared problem of input file formats to output file formats. Instead of having a different one, a different converter for every.
00:14:44.000 --> 00:14:54.000
pair, uh, which would be horrible. Uh, instead, what you have is, uh, a system where it can.
00:14:54.000 --> 00:14:56.000
Read.
00:14:56.000 --> 00:15:07.000
any input file into an intermediate format, which is more like an AST. It's not an actual document, it's a structure.
00:15:05.000 --> 00:15:08.000
And an AST is…
00:15:07.000 --> 00:15:23.000
Uh, an abstract syntax tree? Like, it's not actually an AI… or maybe it is, but whatever it is. It's not a document, it's a… it's a form that represents everything that's in that document.
00:15:10.000 --> 00:15:11.000
Yeah, okay.
00:15:23.000 --> 00:15:38.000
but probably only in memory. And then it has the opposite thing on the other side. From that intermediate form, produce one of these. Uh, big players in my world are, uh.
00:15:25.000 --> 00:15:28.000
In a structured way, yeah.
00:15:38.000 --> 00:15:43.000
Markdown documents, HTML, and PDF.
00:15:42.000 --> 00:15:44.000
Hmm, yeah.
00:15:43.000 --> 00:15:55.000
Um, and I will convert back and forth between those, but it knows something like, what is it, 80 different formats? And I think the formats are plugins.
00:15:44.000 --> 00:15:46.000
Yeah, that's… I've done both.
00:15:51.000 --> 00:15:54.000
It's a… it's a bunch.
00:15:55.000 --> 00:16:03.000
Um, as long as you know how to, uh, produce or consume the intermediate format, um…
00:15:55.000 --> 00:15:58.000
Yeah, it's.
00:16:03.000 --> 00:16:13.000
Yeah, and like with… I know with Markdown, there's a lot of different flavors of Markdown, with extensions and things, and Pandoc, uh, seems to handle all those things.
00:16:03.000 --> 00:16:05.000
I think you're you're.
00:16:09.000 --> 00:16:10.000
There are.
00:16:12.000 --> 00:16:14.000
Knows them all.
00:16:13.000 --> 00:16:20.000
Yeah, yeah, it's kind of neat. Anyway, happy 20th anniversary to the Pandoc project.
00:16:18.000 --> 00:16:25.000
You know, um… Umm… John Groomer.
00:16:25.000 --> 00:16:31.000
I think, has an opinion about how many different flavors of Markdown there are.
00:16:26.000 --> 00:16:28.000
Yah.
00:16:30.000 --> 00:16:32.000
Yeah.
00:16:32.000 --> 00:16:33.000
Err.
00:16:32.000 --> 00:16:35.000
For him, there's one.
00:16:34.000 --> 00:16:50.000
I'm kind of guessing, but yeah, I think he thinks… I think he… he… and I believe he has a pretty good claim on this. There is one. So, it's called Markdown, and there's… there's rules for how it works. Now, there's some other things…
00:16:36.000 --> 00:16:37.000
Yeah.
00:16:50.000 --> 00:16:54.000
that have Markdown in their name.
00:16:54.000 --> 00:17:02.000
Uhm… Like, GitHub-flavored markdown, and CommonMark, and things like that. But…
00:16:58.000 --> 00:16:59.000
Sure.
00:17:00.000 --> 00:17:01.000
Oh yeah.
00:17:02.000 --> 00:17:04.000
Umm.
00:17:04.000 --> 00:17:11.000
You know, Markdown. The thing. It's not just John Gruber, it's also Aaron Schwartz. Remember Aaron Schwartz?
00:17:10.000 --> 00:17:12.000
Oh yeah.
00:17:12.000 --> 00:17:17.000
A tremendous loss to the community.
00:17:12.000 --> 00:17:15.000
Yeah, his name came up last week for something, yeah.
00:17:16.000 --> 00:17:17.000
Yeah.
00:17:17.000 --> 00:17:30.000
He… he was a genius, and he was, uh, significant input into the design and, uh, maybe implementation of Markdown?
00:17:18.000 --> 00:17:19.000
Yah.
00:17:30.000 --> 00:17:33.000
Um, and… And he should be remembered for that.
00:17:33.000 --> 00:17:35.000
Yeah, yeah, you should.
00:17:35.000 --> 00:17:49.000
He should. Um, so, anyway, happy birthday, uh, Pandoc. Uh, if you don't under… if you don't know that project, go take a look at it. It's pretty neat if you want to convert files, uh, document.
00:17:46.000 --> 00:17:50.000
You didn't say the most interesting thing about Pandoc.
00:17:49.000 --> 00:17:51.000
Ah, what's that?
00:17:51.000 --> 00:17:54.000
What is it implemented in?
00:17:55.000 --> 00:17:59.000
Um, okay, if you're asking that question, it's almost certainly Rust.
00:17:59.000 --> 00:18:03.000
It is not! It is Haskell.
00:18:01.000 --> 00:18:03.000
Oh, what is it?
00:18:03.000 --> 00:18:27.000
Oh, that's right! Oh, oh, that's right. I knew that. I knew that. Haskell. I forgot. I even had it in my notes. Um, it is… it is, uh, the most popular Haskell project, uh, according to the Haskell website. I… I wanna… I want to take a look at the source code, because I've never seen Haskell. Have you ever done anything at all with it? I've never even seen it.
00:18:26.000 --> 00:18:27.000
I have.
00:18:27.000 --> 00:18:31.000
I want to take a look at it.
00:18:30.000 --> 00:18:35.000
It
is very interesting. A interesting thing to know, by the way.
00:18:35.000 --> 00:18:45.000
Uh… I believe it is the case that the primary implementer behind Pandoc?
00:18:45.000 --> 00:18:51.000
It's also the driving force behind the common mark.
00:18:51.000 --> 00:18:54.000
a variation of Markdown.
00:18:52.000 --> 00:19:02.000
Yeah, yeah, I think I saw that, uh, because Pandoc seems to favor CommonMark when you start looking at their webpages and stuff.
00:19:02.000 --> 00:19:16.000
the documentation, um, which is good. You know, I always thought plain old Markdown, the official Markdown, sort of lacked a few things. Doesn't it not do tables or something? There's some stuff that it doesn't do very well.
00:19:14.000 --> 00:19:17.000
That's one thing it doesn't do.
00:19:17.000 --> 00:19:22.000
And that's kind of important, I think, for at least the things that I do in Markdown.
00:19:23.000 --> 00:19:35.000
Oh, gosh. Alright, you know, why don't we get into this? Uh, like I said earlier, we're gonna talk about testing. And this is not… This is not to convince you that you should be doing testing.
00:19:35.000 --> 00:19:50.000
This is about if you, assuming you want to do testing, um, this is kind of how, how to get going with it. And I, you know, Wolf, Wolf talks about tests all the time. He, he, he, he's a real big, uh, proponent.
00:19:50.000 --> 00:20:10.000
for doing testing. And I… I believe testing is important. I don't do it. I'm talking about automated testing. I just don't do it because I just can't seem to get my **** in gear to actually make it happen. And I think today's episode is going to help me.
00:20:10.000 --> 00:20:25.000
Uh, to move forward. And I hope it helps, uh, all of you out there too, if you're, uh, if you're not doing testing and, and, and Wolf's going to sort of tell us why we should and how we can and, and all of those kinds of things. So Wolf, you want to, you want to take it?
00:20:26.000 --> 00:20:41.000
Yeah, I think there's a spectrum, like there is for everything. And at one end of the spectrum, there's people who rely on tests, who need them and trust them, and they're part of the normal workflow.
00:20:41.000 --> 00:20:46.000
I don't think I'm at the very, very, very tip of that end.
00:20:46.000 --> 00:21:01.000
Um… Because I don't always… I don't have 100% coverage, and um… I don't make sure I have every single kind of test.
00:21:01.000 --> 00:21:32.000
And, uh, I don't… I… I use TDD, which is kind of extreme, um… when it suits me, but that… that's not a force behind… who I am or me getting the code done. TDD is test-driven development. It's where you have an idea that you want to implement or a bug you want to fix, but before you write the actual code to do that, you write the test.
00:21:32.000 --> 00:21:39.000
And you watch the test fail, and then you write the code, and you know you're done when the test goes green.
00:21:39.000 --> 00:21:47.000
So that's one end of the spectrum, and at the far end
of the other end of the spectrum.
00:21:47.000 --> 00:21:57.000
uh, side of the spectrum, are people who don't see any value at all in tests. They can't imagine why they would waste their time writing tests.
00:21:57.000 --> 00:22:12.000
Um… that's not you. Uh, closer in towards me, but still at that end, are the people who, uh, aren't opposed, and then even further in, are the people who realize.
00:22:12.000 --> 00:22:18.000
Tests do have value. It's obvious they're doing something for somebody. They've seen it.
00:22:18.000 --> 00:22:30.000
But, man, is there a huge gap between… and it's this way for almost everything, right? The distance from 0 to 1?
00:22:30.000 --> 00:22:35.000
is gigantic. And the distance from one to a hundred?
00:22:35.000 --> 00:22:42.000
Nothing like that, not even close. It's a long way to go from zero to anything.
00:22:42.000 --> 00:22:45.000
But once you're at one.
00:22:45.000 --> 00:22:50.000
It's just a hop, skip, and a jump to get to 100. Not a problem.
00:22:47.000 --> 00:22:52.000
And that's where I need to get. I need to get to one.
00:22:52.000 --> 00:22:53.000
Yeah.
00:22:52.000 --> 00:22:56.000
So that I could start filling in the tests that I need.
00:22:56.000 --> 00:22:59.000
And some people say stuff like.
00:22:56.000 --> 00:22:58.000
So, yeah.
00:23:00.000 --> 00:23:16.000
I'm gonna liken this to something inside the testing methodology, like when people use test-driven development. They say, oh, your first test should just be, you know, this function is supposed to return 4, so you test that it returns 4.
00:23:16.000 --> 00:23:21.000
And then you go write the function, and all you write is return 4.
00:23:21.000 --> 00:23:30.000
Oy vey. Um, you know, I, I like testing, but that, that **** is just needless ceremony.
00:23:30.000 --> 00:23:31.000
Right?
00:23:31.000 --> 00:23:45.000
That's… I don't… I don't know what that is. Um… But… Essentially, um… You need to take a couple of steps.
00:23:45.000 --> 00:23:50.000
One step is where you can write a test at all.
00:23:51.000 --> 00:24:00.000
And the next step is where running those tests and seeing if they passed or failed.
00:24:00.000 --> 00:24:20.000
is an automatic part of your workflow. Not automatic because it's second nature to you. Automatic because… It's in pre-commit, or it's in, um, you know, the script that you run that does all the things you have to do before you can deliver.
00:24:20.000 --> 00:24:35.000
For some languages, you always have a thing like that, a thing that's in between you and the customers. Like, if you're writing a C++ program, there's a stage where you compile.
00:24:35.000 --> 00:24:36.000
Sure.
00:24:36.000 --> 00:24:43.000
If you're gonna compile… Why not add another step that is, now that you've compiled, run the tests?
00:24:43.000 --> 00:24:50.000
If you're using a language where there's no separate or noticeable or distinct.
00:24:50.000 --> 00:24:57.000
compile phase, like Perl, or Python, or, uh.
00:24:55.000 --> 00:24:56.000
Mmhm.
00:24:57.000 --> 00:24:58.000
Maybe even.
00:24:57.000 --> 00:24:58.000
JavaScript.
00:24:58.000 --> 00:25:05.000
JavaScript, but maybe even Java counts in this, not 100% sure.
00:25:01.000 --> 00:25:03.000
Yeah, thank you.
00:25:06.000 --> 00:25:11.000
There isn't an easy affordance to that, although pre-commit's pretty good.
00:25:11.000 --> 00:25:16.000
Uhm… And then making testing unavoidable.
00:25:16.000 --> 00:25:32.000
And then the second nature part about… just writing the tests all the time, because, uh, you know, it's amortized. If you, uh, change the way some API is designed.
00:25:32.000 --> 00:25:39.000
And you fix the tests right then, and you notice right away, because you run the tests every time.
00:25:39.000 --> 00:25:55.000
Then you're only writing, you know, 2 or 3 tests at a time, um, and the work you do is small, and the… activity of seeing a broken test is rare and small and.
00:25:55.000 --> 00:26:12.000
You know, it's like when you do it the right way in some particular algorithm, like growing your hash table or not. Sure, it's expensive to grow the hash table once it is too heavily populated, saturated.
00:26:12.000 --> 00:26:19.000
Um, because now you have to rehash and copy all the keys, for instance, if that's the kind of hash table you have.
00:26:19.000 --> 00:26:30.000
But because, for… 15 minutes up until then, you'd just been adding keys, um, over and over with no growing at all.
00:26:30.000 --> 00:26:51.000
So that big balloon payment you made, um… You really amortize that over the… 2 hours, or 15 minutes, or whatever it was, of individual entries, and it turns out to be small. But in testing, it actually is small. It's amortized physically as well as logically.
00:26:50.000 --> 00:26:51.000
Umm.
00:26:51.000 --> 00:26:52.000
So.
00:26:52.000 --> 00:27:01.000
You've got something in the way. And the thing that's in the way is… You've never written a test.
00:27:01.000 --> 00:27:02.000
So there's that.
00:27:02.000 --> 00:27:06.000
You've never run a test, so there's that.
00:27:06.000 --> 00:27:09.000
And maybe Pearl will help you.
00:27:09.000 --> 00:27:11.000
Write tests.
00:27:11.000 --> 00:27:24.000
Like, for instance, in Python, there are many, uh… testing packages that will help you. I think the best one is probably PyTest.
00:27:24.000 --> 00:27:34.000
A lot of these testing packages came from, um, other places, like originally Smalltalk.
00:27:34.000 --> 00:27:39.000
Java had some very important contributions to the testing landscape.
00:27:38.000 --> 00:27:39.000
Hmmm.
00:27:39.000 --> 00:27:44.000
Did you look around? Do you know if Pearl gives you something?
00:27:42.000 --> 00:27:51.000
Oh, yeah, there's a… there's a… there's a well-known testing framework, uh, for Perl. In fact, if you install… if you build a CPAN package.
00:27:51.000 --> 00:28:08.000
Um, I, I had a platform before where I had to, I couldn't install CPAN packages using the CPAN tool. I could
just download the package from CPAN and build it myself. And there's, there's a testing framework there and it's, and if you run CPAN install package name, you'll see the tests run.
00:28:08.000 --> 00:28:19.000
And it always impresses me how many tests some of those packages have. I feel like that's a quality package when I see 60 tests for that one thing.
00:28:09.000 --> 00:28:11.000
And I have.
00:28:19.000 --> 00:28:30.000
Okay, so you know of a package. Is the package itself an obstacle? Is it hard to use, really big, bad API?
00:28:23.000 --> 00:28:24.000
Sure.
00:28:29.000 --> 00:28:37.000
No, no, it's, it's, it's slowing, you know, I'm moving along at 100 miles an hour every day.
00:28:37.000 --> 00:28:39.000
That's right.
00:28:37.000 --> 00:28:49.000
In order to do the testing, I'm gonna have to stop. Yeah, I'm gonna… you hit this, and you dealt with it a long, long time ago.
00:28:40.000 --> 00:28:42.000
Me too.
00:28:50.000 --> 00:28:57.000
I just haven't… slowed down the freight train enough yet to do the testing thing.
00:28:57.000 --> 00:29:10.000
You and I are very, very different in this way, and I think we've talked about it before, in that, um… We both want to deliver for the customer.
00:29:09.000 --> 00:29:11.000
Sure. Sure.
00:29:10.000 --> 00:29:26.000
Um, and your way of delivering is to work directly on the problem, as hard as you reasonably can, in a way that produces the best result, and get that to delivery as quickly as possible.
00:29:28.000 --> 00:29:29.000
Sure.
00:29:29.000 --> 00:29:34.000
That's you. Uh, and my way is, um…
00:29:30.000 --> 00:29:31.000
Yeah.
00:29:35.000 --> 00:29:46.000
See, my way, I know all kinds of, um… uh, adverbs and metaphors for. Uh, I think it was Abraham Lincoln, maybe?
00:29:46.000 --> 00:29:51.000
Somebody? Who said, if I had, uh, 6…
00:29:49.000 --> 00:29:52.000
Oh, when he was talking about testing?
00:29:52.000 --> 00:29:55.000
Six hours to chop down a tree.
00:29:55.000 --> 00:29:56.000
Yeah.
00:29:55.000 --> 00:30:03.000
I'd spend the first four sharpening my saw, or axe, or whatever. Uh, so, for me, I feel like.
00:29:56.000 --> 00:29:57.000
Yep.
00:29:58.000 --> 00:29:59.000
Sure.
00:29:59.000 --> 00:30:00.000
Sure, sure.
00:30:03.000 --> 00:30:14.000
it's okay to stop and do the thing that I know, in the end, is gonna make me go faster, not just for this one delivery, but forever.
00:30:14.000 --> 00:30:25.000
Um… A difference between you and me is, and I've noticed this, um… You predict in advance.
00:30:25.000 --> 00:30:29.000
What the switching cost is going to be.
00:30:29.000 --> 00:30:37.000
You say to yourself, oh, it's going to take me 10 hours to get testing into my pipeline.
00:30:37.000 --> 00:30:48.000
Um, and you let that 10 hours be weighed against what 10 hours of honest work on the real deliverable would be.
00:30:44.000 --> 00:30:46.000
Sure.
00:30:48.000 --> 00:30:58.000
And so, you're taking a high confidence number, the work, the deliverable, against a super low confidence number.
00:30:58.000 --> 00:31:05.000
But that doesn't matter to you. You just say, well… It's not worth it right now. Let me do this one. Maybe later.
00:31:04.000 --> 00:31:13.000
Yeah, yeah. Plus, plus, I get paid for delivering stuff to my client.
00:31:07.000 --> 00:31:08.000
Right.
00:31:13.000 --> 00:31:20.000
Um, working on my infrastructure is not paid time, so that influences what I'm gonna spend my time on.
00:31:20.000 --> 00:31:23.000
And I realize it's flawed.
00:31:23.000 --> 00:31:40.000
I just need to need to slow down this freight train and do the work. We've gotten into a rhythm. We've gotten into this rhythm in my company where we go through periods where we're working hard, really hard to deliver something.
00:31:30.000 --> 00:31:32.000
Well, maybe. I mean…
00:31:40.000 --> 00:31:55.000
And then we, then we might get like two or three weeks where the pressure is off. And what I need to do is jump the next time that happens and, and commit myself to, uh, to, to start the testing process, uh, the next time I get that.
00:31:55.000 --> 00:31:59.000
two or three week lull. I think that'd be a great use of my time during then.
00:32:01.000 --> 00:32:02.000
Umm.
00:32:03.000 --> 00:32:09.000
So you just said something to me, and I'm gonna paraphrase it. It started with.
00:32:08.000 --> 00:32:09.000
Umm.
00:32:09.000 --> 00:32:11.000
I'm gonna wait.
00:32:10.000 --> 00:32:12.000
Yeah.
00:32:11.000 --> 00:32:13.000
And then it just stopped.
00:32:14.000 --> 00:32:26.000
Because there, you know, like, what's the right time to apologize? What's the right time to blah blah blah? What's the right time? There's never a right time.
00:32:22.000 --> 00:32:25.000
Oh yeah, yeah, yeah.
00:32:26.000 --> 00:32:27.000
Sure, sure.
00:32:26.000 --> 00:32:34.000
It never comes. So there's only two answers. It's just like there's only two sane numbers in the world.
00:32:28.000 --> 00:32:29.000
Right.
00:32:34.000 --> 00:32:35.000
Right?
00:32:35.000 --> 00:32:44.000
I guess there's 3. There's 0, there's 1, and there's infinity. And anything in between is probably magic.
00:32:44.000 --> 00:32:51.000
If you have to do something, there are two good times. There's right now, and there's never.
00:32:48.000 --> 00:32:49.000
Yeah. Hmm.
00:32:49.000 --> 00:32:51.000
Yep.
00:32:51.000 --> 00:32:53.000
Yeah, well…
00:32:53.000 --> 00:32:57.000
So if you're not picking right now, explicitly.
00:32:57.000 --> 00:33:01.000
You are picking never implicitly.
00:33:00.000 --> 00:33:03.000
Yeah, okay. Okay.
00:33:02.000 --> 00:33:05.000
All right, so.
00:33:05.000 --> 00:33:06.000
Umm.
00:33:08.000 --> 00:33:11.000
What I think is motivating.
00:33:11.000 --> 00:33:25.000
is, uh, first of all, a thing I can't promise you, but let's attach it to a thing I can promise you. A thing that is motivating is when you write a test.
00:33:25.000 --> 00:33:31.000
And either immediately… Or… Sometime.
00:33:31.000 --> 00:33:46.000
that test fails, for
real, and teaches you something you didn't know before. Like, hey, guess what? This routine I wrote isn't thread-safe, and I thought it was! Like, that's a big deal.
00:33:46.000 --> 00:33:48.000
Learning that fact.
00:33:48.000 --> 00:33:54.000
is way better than learning it from one of your customers.
00:33:53.000 --> 00:33:55.000
Mmhm.
00:33:55.000 --> 00:33:56.000
Right.
00:33:56.000 --> 00:34:00.000
throughout your code, so that's the thing I can't promise you.
00:34:00.000 --> 00:34:06.000
Um, and also… Whatever your testing situation is.
00:34:06.000 --> 00:34:10.000
It doesn't tell you that you're bug free.
00:34:10.000 --> 00:34:17.000
What it does is… A test turning red tells you you do have a bug.
00:34:17.000 --> 00:34:21.000
But, this is the classic, you-can't-prove-a-negative thing.
00:34:20.000 --> 00:34:22.000
Sure, sure.
00:34:21.000 --> 00:34:28.000
All you can show is my tests ran. So… In your code.
00:34:28.000 --> 00:34:33.000
You deal with all kinds of things at all different levels.
00:34:33.000 --> 00:34:49.000
you have made it, uh, uh, public to people listening to our podcast that you write medical software. So, obviously, uh, the integrity and privacy of, uh, personal information for.
00:34:40.000 --> 00:34:41.000
Mmhm.
00:34:49.000 --> 00:34:50.000
Patience.
00:34:50.000 --> 00:34:58.000
is a top priority for you. You want to keep that information safe, private, and protected.
00:34:53.000 --> 00:34:55.000
Mmhm.
00:34:59.000 --> 00:35:08.000
So this could be a critical area where you could write tests. Hey, does this thing get exposed here?
00:35:08.000 --> 00:35:15.000
Or something. Maybe that's not the right place to look. I don't know your code. YOU know your code.
00:35:15.000 --> 00:35:25.000
What you are looking for is, um… Something that… Changes a lot, maybe.
00:35:25.000 --> 00:35:36.000
Some piece of code where the code changes, or faces new inputs, or something like that, but there's change, there's flux.
00:35:36.000 --> 00:35:45.000
Um, that… If something goes wrong with this code, the blast radius is big.
00:35:45.000 --> 00:35:50.000
Like, this particular thing going wrong makes 10 other things go wrong.
00:35:50.000 --> 00:35:56.000
And the cost to either fix it or repair it.
00:35:56.000 --> 00:35:58.000
is high.
00:35:58.000 --> 00:36:04.000
When you identify a place like that in your code, that's a thing.
00:36:04.000 --> 00:36:07.000
That might be a good place to start.
00:36:07.000 --> 00:36:10.000
All I want to do.
00:36:10.000 --> 00:36:14.000
is I want to find success for me for this episode.
00:36:14.000 --> 00:36:16.000
Episode is.
00:36:16.000 --> 00:36:28.000
if you and I can agree, you don't even have to tell me what it is, but if we leave this show where you know the place in your code.
00:36:28.000 --> 00:36:30.000
That's WORTH.
00:36:30.000 --> 00:36:36.000
Overcoming that inertia and writing a single test.
00:36:36.000 --> 00:36:39.000
If you can know that place.
00:36:40.000 --> 00:36:43.000
This episode is going to be a success for me.
00:36:42.000 --> 00:36:45.000
Sure, sure, okay.
00:36:43.000 --> 00:36:48.000
So the way we start is you figure out that place.
00:36:48.000 --> 00:36:49.000
Umm.
00:36:49.000 --> 00:36:54.000
And what you care about is that it's critical, not that writing a test would be easy.
00:36:54.000 --> 00:37:00.000
But… You can't choose something that's so hard to test.
00:37:00.000 --> 00:37:10.000
it turns into, uh, an obstacle. Like… You try and try, it doesn't work, you can't make a test, and so you give up forever. I don't want that.
00:37:10.000 --> 00:37:15.000
What I want is something that's a balance. It's critical, but reachable.
00:37:16.000 --> 00:37:23.000
And then, on our next episode, we talk about the one test.
00:37:23.000 --> 00:37:25.000
You wrote.
00:37:25.000 --> 00:37:26.000
Hmm. Okay.
00:37:26.000 --> 00:37:30.000
You're assuming I'm gonna write a test in two weeks. That's funny.
00:37:30.000 --> 00:37:33.000
All it has to be is one test.
00:37:30.000 --> 00:37:32.000
You're cute.
00:37:33.000 --> 00:37:44.000
Okay, let me… you know, I've been saying I don't do testing, and it's not exactly true. I have a library of functions that I've written in Perl.
00:37:44.000 --> 00:38:06.000
that, uh, I don't know, contains about 40 or… 50… Just little utility things, you know, convert things to upper case, upper and lower case, combine a first name and last name in an intelligent way. I do have tests for those. I wrote those tests years and years ago. And here's the thing that just amazed me. I wrote those tests.
00:38:06.000 --> 00:38:18.000
Uh, you know, validate a phone number, uh, validate a social security number, those kinds of things. I wrote those tests, and immediately, I found cases that, that didn't, didn't pass the test.
00:38:18.000 --> 00:38:36.000
You know, it was… it was eye-opening. I… oh yeah, I found, uh, cases where, uh, I gave it some input, and it did not produce the output that it should have. Those… those tests, I have really clear in my head how to do those.
00:38:20.000 --> 00:38:23.000
The thing I couldn't promise you.
00:38:36.000 --> 00:38:51.000
how to write that kind of test. You know, you give it a phone number, and you want it to produce an edited version of that phone number, or you want to validate that phone number to make sure it's a valid-looking phone number, right? Those are really straightforward to me.
00:38:51.000 --> 00:39:07.000
Uh, you give it an email address. That's primarily a big regex, right, to handle all the possibilities. So, then you feed it a whole bunch of email addresses, and we've got a database with probably 750,000 patients.
00:38:56.000 --> 00:38:57.000
Uh-huh.
00:39:07.000 --> 00:39:21.000
A lot of them have email addresses. So I've run my tests against the entire database, you know, to see. And yes, I've found email addresses that are not valid. So I do understand.
00:39:21.000 --> 00:39:26.000
that I need to test. I do
have some tests, but I'll tell you what really bogs me down.
00:39:24.000 --> 00:39:26.000
And you've had success.
00:39:26.000 --> 00:39:36.000
Yes, I've had success, I've seen the value, and I do run those tests. That's a module that contains all those functions. It doesn't change.
00:39:36.000 --> 00:39:50.000
you know, it just doesn't change much. So it's, you know, I'm not constantly finding new cases where it failed. So it's great to have those tests, and I made that library better as a result.
00:39:49.000 --> 00:39:55.000
So you've got some experience, but it doesn't solve this problem.
00:39:50.000 --> 00:40:05.000
But, let me… yeah, let me tell you… Let me tell you… where my… where my problems are in thinking how to test. And then maybe we can discuss ways to do these things.
00:40:05.000 --> 00:40:24.000
a whole lot of my code touches the database. It updates the database, it reads from the database, it inserts new rows into the database, and I've got this 4TB database is my, you know, my customer data set, and we… I don't have a copy of that data in my development environment.
00:40:24.000 --> 00:40:27.000
But we do have a, uh, uh, uh, uh.
00:40:27.000 --> 00:40:37.000
a snapshot of the database to work with at the client. So I can run, you know, tests and stuff against that. But I don't really understand how to write a test.
00:40:37.000 --> 00:40:40.000
that does some database work.
00:40:40.000 --> 00:40:49.000
Uh, how do you do that? How do you… you know? Especially if I want to do it here, uh, on my little tiny database.
00:40:49.000 --> 00:41:14.000
I just don't know where to begin, uh, how to deal with a database, uh, a module that talks to the database, how to do the testing on it. It just, it… It's not in my head how to do that. Before we start to, you know, talk about a solution to that. Another thing I do is a lot of UI stuff in a web browser. You know, it's JavaScript, HTML in a web browser.
00:41:14.000 --> 00:41:24.000
I don't know how to test that. I know there's things like Selenium that you can use. I haven't tried it. These are, like, these are the hurdles that are stopping me from going forward.
00:41:26.000 --> 00:41:28.000
I hear ya.
00:41:27.000 --> 00:41:42.000
How do you do that, right? How do you… and, you know, it's… my code is not only Perl. Like I said, there's some JavaScript. Now I'm working in TypeScript, and a whole other platform, I'm doing Swift development on a Mac. And, you know, obviously.
00:41:43.000 --> 00:41:54.000
maybe not obviously, but certainly there is a whole testing methodology for Swift and SwiftUI, and I've largely ignored it, sad to say, but I really need to do it. But again.
00:41:54.000 --> 00:42:03.000
you know, there's a lot of network stuff going on. How do you test that? It's sort of like a database problem. How do you test things that go through the network?
00:42:03.000 --> 00:42:06.000
This is where I get hung up.
00:42:04.000 --> 00:42:06.000
Um, okay.
00:42:06.000 --> 00:42:11.000
So let's talk about a couple of things. Let's talk about if…
00:42:08.000 --> 00:42:09.000
Yeah.
00:42:11.000 --> 00:42:21.000
Hard problems, like these, are the right starting place. Let's talk about, okay, they are the right starting place. How do you solve it?
00:42:21.000 --> 00:42:28.000
Um… What things about… so, um, there's… Up.
00:42:28.000 --> 00:42:31.000
A test can be flaky.
00:42:31.000 --> 00:42:32.000
or not.
00:42:32.000 --> 00:42:37.000
A network test might be flaky.
00:42:37.000 --> 00:42:43.000
In the particular testing framework that I use.
00:42:43.000 --> 00:42:52.000
You can mark particular… you can mark any test you want with anything that you want, and then you can run tests.
00:42:52.000 --> 00:43:04.000
based on which ones have specific marks. So, for instance, um, a thing that I do is I mark tests that are slow. Um, and tests that are slow.
00:43:04.000 --> 00:43:08.000
I run in a full test.
00:43:08.000 --> 00:43:23.000
but I don't run as part of my, uh, pre-commit test runs. So, you know, I commit, commit, commit all the time, but I don't commit without running the tests. But when I run the tests for commit.
00:43:23.000 --> 00:43:28.000
I want those tests to complete in 5 seconds or less.
00:43:28.000 --> 00:43:31.000
And so if I have a slow test.
00:43:31.000 --> 00:43:34.000
I just omit it from the pre-commit tests.
00:43:33.000 --> 00:43:34.000
Sure.
00:43:34.000 --> 00:43:44.000
And then later, when I'm gonna do a release, or when it's on my CICD machine, or whatever, that runs all the tests.
00:43:44.000 --> 00:43:52.000
If a test is going to be flaky, well, that's a problem. That's a question about whether you're going to trust that test.
00:43:52.000 --> 00:43:53.000
U-huh.
00:43:52.000 --> 00:44:00.000
Did it fail because the networking failed underneath it, or because it actually did the wrong thing?
00:44:00.000 --> 00:44:05.000
Um, and either you can tell the difference between those two things.
00:44:05.000 --> 00:44:15.000
or you can't. If you can't, is it a reasonable test? Is it a test that gives you new information? Let's talk about the database problem.
00:44:14.000 --> 00:44:16.000
Umm.
00:44:15.000 --> 00:44:22.000
What part about communicating with the database is in between you.
00:44:22.000 --> 00:44:26.000
and knowing whether the thing you wrote works or not.
00:44:27.000 --> 00:44:36.000
Well, let me… Let me clear something up first. You know, we mentioned I'm in the healthcare business, right?
00:44:36.000 --> 00:44:55.000
I'm not writing… I'm writing, like, business software for healthcare. You know, scheduling, billing, workflow, stuff like that. I'm not writing software that examines digital x-rays and decides if there's cancer there or not.
00:44:55.000 --> 00:45:10.000
That, you know, so it's not… it's business software that I write. The fact that it's used in a medical office, that's just how it is, right? It's, uh… so I don't want people to think that I'm writing software
that's dangerous in a medical.
00:45:10.000 --> 00:45:29.000
Uh, setting. Um… The kinds of things I think about that I would like to be able to test would be, we manage the patient ledger. That's the charges that are billed to the patient.
00:45:29.000 --> 00:45:42.000
you know, the claim is sent to the insurance company, the payment comes back, and we process the payment file. It's all electronic. We process a payment file and apply those payments to that patient's ledger. So.
00:45:42.000 --> 00:45:46.000
I start thinking, man, how could I test that? First of all.
00:45:47.000 --> 00:45:59.000
Um… I get a payment file from the insurance company that's expecting certain patients to be in the database.
00:45:59.000 --> 00:46:03.000
I don't even know where to begin that kind of a thing.
00:45:59.000 --> 00:46:03.000
Okay, I can already stop you.
00:46:03.000 --> 00:46:04.000
Yes.
00:46:03.000 --> 00:46:07.000
Um… You are thinking big.
00:46:07.000 --> 00:46:09.000
And tests…
00:46:08.000 --> 00:46:09.000
Yah.
00:46:09.000 --> 00:46:13.000
are useful when they're small.
00:46:13.000 --> 00:46:17.000
Okay, so that's that's a big part part of my issue.
00:46:13.000 --> 00:46:20.000
So, that big thing isn't one test. It might be six.
00:46:19.000 --> 00:46:21.000
Yah.
00:46:20.000 --> 00:46:31.000
Um, where one of those tests is, uh, am I getting the right thing out of a received, um, insurance, uh.
00:46:31.000 --> 00:46:41.000
posting to me? Number two is, um, can I make a change to the patient ledger? Number three is, um.
00:46:41.000 --> 00:46:44.000
You know when you put them all together.
00:46:44.000 --> 00:47:04.000
And you do a big operation that… uses a real insurance document, and knows about the patient being in the database, and does the entire ledger transaction, and uses the network. That's not a unit test anymore. Unit tests are small.
00:47:04.000 --> 00:47:08.000
A unit test says this function.
00:47:08.000 --> 00:47:10.000
Does.
00:47:10.000 --> 00:47:12.000
What it says on the label.
00:47:12.000 --> 00:47:17.000
Its API makes a promise, it's gonna do this thing.
00:47:17.000 --> 00:47:22.000
And the test you write says it did what it promised.
00:47:22.000 --> 00:47:36.000
When you make a big thing that needs a whole bunch of components together and isn't satisfied by pretending it's got to be the real things, that's called an integration test.
00:47:36.000 --> 00:47:39.000
Integration tests are valuable.
00:47:39.000 --> 00:47:41.000
But they're expensive.
00:47:41.000 --> 00:47:56.000
and they're harder to write, and they're harder to run. When you're using Selenium on a web page, that is much closer to what we think of as integration testing than unit testing.
00:47:43.000 --> 00:47:44.000
Mmhm.
00:47:56.000 --> 00:47:57.000
Okay.
00:47:56.000 --> 00:48:03.000
So, let's just take the tiniest part of.
00:48:03.000 --> 00:48:05.000
Um… that.
00:48:05.000 --> 00:48:08.000
Uh, database transaction.
00:48:08.000 --> 00:48:17.000
Uh,
the database knows stuff about the patient's current state of payment and whatnot.
00:48:16.000 --> 00:48:19.000
Mm-hmm, mm-hmm, the balance.
00:48:19.000 --> 00:48:24.000
And you've got a function that is gonna make some changes.
00:48:26.000 --> 00:48:30.000
And then… Once those changes are made.
00:48:30.000 --> 00:48:45.000
Everything should be back in a consistent state that matches what you and I both refer to as the invariance of the patient, or the patient's database records.
00:48:45.000 --> 00:48:51.000
Um, like, for instance, uh, a bank transaction, um.
00:48:51.000 --> 00:49:00.000
It might be that in the middle of the deposit function, or the withdrawal function, or the transfer function.
00:48:59.000 --> 00:49:00.000
Mmhm.
00:49:00.000 --> 00:49:06.000
Inside any one of those functions, the invariant might be broken.
00:49:06.000 --> 00:49:19.000
Uh, the invariant being, um, that if you add up all the accounts of this customer, they must equal exactly the total amount of money they really have.
00:49:19.000 --> 00:49:20.000
Mmhm.
00:49:19.000 --> 00:49:25.000
But during a transfer, it might be the case that if you're transferring $50.
00:49:25.000 --> 00:49:39.000
It might be the case that, uh, temporarily, their total balance, if you were to calculate it, is $50 too high, or $50 too low, depending on what order you do it in.
00:49:39.000 --> 00:49:42.000
Um… So.
00:49:42.000 --> 00:49:43.000
What can you test?
00:49:43.000 --> 00:49:46.000
You can test… that.
00:49:46.000 --> 00:49:52.000
The state BEFORE you do your operation is a given thing.
00:49:52.000 --> 00:49:55.000
And then you do your operation.
00:49:55.000 --> 00:50:05.000
And then you test if the state AFTER the operation is consistent, meets the invariance, and is what you expected.
00:50:05.000 --> 00:50:09.000
And that's all. Did they get the $50?
00:50:09.000 --> 00:50:19.000
In my framework, pytest, and actually in all the Python testing frameworks that I know of.
00:50:19.000 --> 00:50:20.000
You.
00:50:20.000 --> 00:50:34.000
Uh… either pass or fail the test by raising an exception, an assertion, or whatever. So, you assert that the answer is such and such.
00:50:28.000 --> 00:50:29.000
Mmhm.
00:50:34.000 --> 00:50:39.000
that they only have $50 total or whatever.
00:50:40.000 --> 00:50:48.000
Uh, they actually describe this as the, um, three A's. The first A is arrange.
00:50:48.000 --> 00:50:58.000
the second A is assert, and the third A is… Oh, no, no, the third A is assert. The middle A is assert.
00:50:58.000 --> 00:51:05.000
effect or something, that's where you run your function that you're actually testing. Um, there's a couple different.
00:51:05.000 --> 00:51:13.000
Names, or… acronyms or whatever for this. But the idea is… Like I'm always saying.
00:51:13.000 --> 00:51:16.000
It's about the promises.
00:51:16.000 --> 00:51:17.000
Sure.
00:51:16.000 --> 00:51:22.000
Especially don't be tricked into testing the implementation.
00:51:22.000 --> 00:51:24.000
Test the promise.
00:51:24.000 --> 00:51:30.000
This thing says that at the end, you know, it's the bank.transfer function.
00:51:30.000 --> 00:51:33.000
This thing says that at the end.
00:51:33.000 --> 00:51:40.000
This account is gonna be $50 more, and that account is gonna be $50 less.
00:51:40.000 --> 00:51:43.000
Sure, the double entry accounting. Yeah, yeah.
00:51:40.000 --> 00:51:42.000
Test that.
00:51:43.000 --> 00:51:53.000
Yeah, don't test how it did it. Test that it did what it said it was going to do. That way, if you need to change the implementation.
00:51:48.000 --> 00:51:50.000
Yeah, sure.
00:51:50.000 --> 00:51:51.000
So…
00:51:53.000 --> 00:51:57.000
You can change the implementation, and the tests will continue passing.
00:51:57.000 --> 00:52:08.000
Okay, so… I hope I'm not getting back towards too much integration testing, but for me to test that a payment is applied.
00:52:08.000 --> 00:52:10.000
There's a lot of things I have to have.
00:52:10.000 --> 00:52:11.000
I have to have a patient.
00:52:11.000 --> 00:52:28.000
Right? That patient, I have to have a charge, I have to have an encounter, that's the visit between the doctor and the patient. Within that encounter, I have to have services, what are the services that were rendered, you know, an injection or, or an examination or something. For each of those services, I have to have charges.
00:52:28.000 --> 00:52:37.000
posted, uh, that are the fee for doing that service. And now, when I get to that point, now I can apply a payment to that charge.
00:52:35.000 --> 00:52:42.000
See, this still seems like multiple unit tests to me. Like, one unit test says…
00:52:37.000 --> 00:52:45.000
how do I… It does. Multiple unit tests, but not a… but not an integration test?
00:52:45.000 --> 00:52:49.000
Uh, that could all be one integration test, yes.
00:52:48.000 --> 00:52:51.000
Okay, okay.
00:52:51.000 --> 00:52:52.000
Umm.
00:52:52.000 --> 00:52:53.000
So.
00:52:54.000 --> 00:53:00.000
So, do I have to write… what… you said there's the three A's. What was the first one?
00:53:00.000 --> 00:53:04.000
The first one is a range.
00:53:04.000 --> 00:53:10.000
A range, range. So is a range, like, get your stuff ready? Um…
00:53:04.000 --> 00:53:05.000
Like.
00:53:09.000 --> 00:53:18.000
Yeah, make there be a patient, make there be a charge, make there be services, or whatever you need, right?
00:53:10.000 --> 00:53:14.000
with… Okay.
00:53:17.000 --> 00:53:18.000
Sure.
00:53:18.000 --> 00:53:29.000
Uh, and then, the middle A is, uh, effect, or something, I can never remember what the middle A is, but that is, run your function. Do the thing that, that you're trying to test.
00:53:22.000 --> 00:53:24.000
Effect right right.
00:53:28.000 --> 00:53:30.000
Yeah, yeah.
00:53:29.000 --> 00:53:38.000
And then the last A is assert. Um, do however many asserts it takes to, um…
00:53:33.000 --> 00:53:34.000
Ew.
00:53:38.000 --> 00:53:46.000
validate that all invariants are
preserved, and the expected outcome.
00:53:46.000 --> 00:53:48.000
has occurred.
00:53:48.000 --> 00:53:57.000
Okay. So, um, there, there's so many things I should be testing, but if we just sort of stick with this theme for a few minutes.
00:53:57.000 --> 00:54:05.000
um, would it make sense that I create a… a test that creates a patient? It inserts a patient into the system.
00:54:04.000 --> 00:54:06.000
Absolutely.
00:54:05.000 --> 00:54:08.000
That would be a test. Okay.
00:54:06.000 --> 00:54:10.000
I mean, that's a thing you do. You do it all the time, right?
00:54:09.000 --> 00:54:29.000
Oh, yeah, yeah, yeah, and I've got a, I've got a function that does that. So, uh, write a test that does that, and, and, uh, it inserts a patient, and then, uh, the assert part, um… Well, arrange, in this case, I'm starting with the patient's not there, right? I almost don't have to do anything to arrange it.
00:54:29.000 --> 00:54:37.000
You don't, although if it were me, I would probably assert that the patient isn't there. Like, when you add a new patient.
00:54:29.000 --> 00:54:38.000
Then, uh, I… Okay, okay, yeah.
00:54:37.000 --> 00:54:43.000
Uh, like, a thing is, boy, that patient better not already be a patient.
00:54:42.000 --> 00:54:49.000
Sure, okay. So, uh, the effect here would be the actual inserting of that patient into the database.
00:54:49.000 --> 00:54:50.000
Yes.
00:54:50.000 --> 00:54:57.000
running the code that causes that to be in the database. Then the assert is to go read the database and make sure that that patient is there.
00:54:58.000 --> 00:55:03.000
That's right. And it might be that, um.
00:55:03.000 --> 00:55:14.000
You need to do a query. And maybe this is your real database, maybe it's not your real database. It is certainly your real schema.
00:55:14.000 --> 00:55:15.000
Umm.
00:55:14.000 --> 00:55:16.000
Yes.
00:55:16.000 --> 00:55:23.000
But if inserting a patient affects 4 or 5 tables.
00:55:23.000 --> 00:55:29.000
You need to do a query with joins in it to get exactly back what you need to validate.
00:55:29.000 --> 00:55:35.000
Um, if you're expecting these 7 things to exist now.
00:55:35.000 --> 00:55:36.000
Sure.
00:55:35.000 --> 00:55:38.000
and not exist before.
00:55:38.000 --> 00:55:39.000
Okay.
00:55:38.000 --> 00:55:45.000
Um, that's two different queries, one in the arrange part, and one in the assert part.
00:55:39.000 --> 00:55:41.000
So.
00:55:44.000 --> 00:55:58.000
Okay, so let's keep going with this. So now I've got this test that creates a patient. So the end result is I have a patient, right? So then the next test should be I need to create an encounter.
00:55:53.000 --> 00:55:55.000
That's right.
00:55:58.000 --> 00:56:01.000
That's another entry in a database table, right?
00:56:00.000 --> 00:56:14.000
Okay, I do want to say something before you go on, and that is one goal of testing is that tests are independent. They can be run in any order.
00:56:03.000 --> 00:56:05.000
Yeah.
00:56:11.000 -->
00:56:14.000
That's what I'm starting to wonder.
00:56:14.000 --> 00:56:17.000
Right.
00:56:17.000 --> 00:56:23.000
But… Um, if I'm gonna insert an encounter into the system.
00:56:23.000 --> 00:56:35.000
I need to know the patient ID that I'm going to insert that encounter for. And… seems to me that that would be the result of the earlier test. So all of a sudden, we're not independent anymore.
00:56:34.000 --> 00:56:50.000
That's right. So in my world, yes, you do test patient insertion, but also patient insertion is something it happens that you rely upon in what we call.
00:56:35.000 --> 00:56:36.000
Or do it.
00:56:50.000 --> 00:56:54.000
a, um… fixture.
00:56:54.000 --> 00:56:56.000
And so…
00:56:55.000 --> 00:56:56.000
Okay.
00:56:56.000 --> 00:57:05.000
Creating a patient is tested separately and independently. You don't have to worry about that other test.
00:57:00.000 --> 00:57:01.000
Yep.
00:57:05.000 --> 00:57:06.000
Okay.
00:57:05.000 --> 00:57:16.000
creating the new patient. And by the way, um, you're gonna wanna clean up the patient that you made, um, in the first one, so that it's not there anymore.
00:57:07.000 --> 00:57:09.000
Okay.
00:57:12.000 --> 00:57:13.000
Yes.
00:57:16.000 --> 00:57:17.000
Umm.
00:57:19.000 --> 00:57:31.000
I assume, depending on how you write it exactly. But a fixture is a thing that is gonna do exactly what I just said. It's gonna insert a patient.
00:57:20.000 --> 00:57:22.000
Sure.
00:57:22.000 --> 00:57:23.000
Sure, sure.
00:57:32.000 --> 00:57:45.000
you're gonna use the fixture, and then it's going to remove the patient when you're all done. At least, that's how it happens for me in Python. And so, that fixture, you would just name, um…
00:57:37.000 --> 00:57:38.000
Mmhm.
00:57:39.000 --> 00:57:41.000
Okay, okay.
00:57:45.000 --> 00:57:52.000
uh… Existing patient, maybe that's what you called it, in your argument list.
00:57:52.000 --> 00:57:57.000
And what that would do is, inside your function.
00:57:57.000 --> 00:58:09.000
the word existing patient suddenly is an ID. An ID maybe you never saw before, because it's serial or something, uh, and database assigned to PK.
00:58:09.000 --> 00:58:10.000
And.
00:58:10.000 --> 00:58:24.000
And now you know the actual ID of the patient to whom you can attempt this thing of, uh, testing that, um, an encounter is appropriate.
00:58:27.000 --> 00:58:32.000
So this… this fixture… Umm.
00:58:32.000 --> 00:58:42.000
I don't want to spend too much time on this, but this is one of my stumbling blocks. I've got the test that inserts a patient and then removes it when it's done.
00:58:43.000 --> 00:58:49.000
And it's got the code in there to call my function that inserts a patient.
00:58:49.000 --> 00:58:50.000
That's right.
00:58:49.000 --> 00:58:54.000
And, you know, ultimately, it does SQL to insert the patient into the database. Okay.
00:58:54.000 --> 00:59:06.000
So that's that test, and I can test that all day long. It inserts a patient, then removes it. Inserts a patient, removes it. And the way the database works is every time it inserts, it's going to sign the next ID, right? Because it's a serial col.
00:59:03.000 --> 00:59:05.000
That's right.
00:59:06.000 --> 00:59:08.000
So then I'm writing the test…
00:59:06.000 --> 00:59:08.000
But but this is important.
00:59:08.000 --> 00:59:09.000
Yep.
00:59:08.000 --> 00:59:18.000
Um… you don't need to test Postgres. Like, you know Postgres can do an insert. The thing you're testing is…
00:59:13.000 --> 00:59:15.000
Sure.
00:59:16.000 --> 00:59:18.000
I'm not… yeah.
00:59:18.000 --> 00:59:28.000
really your SQL. Did my SQL… because your insert might insert actually into three different tables to get a patient in there.
00:59:26.000 --> 00:59:29.000
Certainly it does. Yeah. Yeah.
00:59:28.000 --> 00:59:36.000
Right. So, it's not about, could Postgres do the insert? It's about, did I get the things in?
00:59:37.000 --> 00:59:43.000
Yeah, but the way you prove that then is to go read it from the database to see that it's in.
00:59:43.000 --> 00:59:48.000
That's right. So really you're testing your SQL.
00:59:44.000 --> 00:59:57.000
Yeah, okay, okay. So I've, so let's say, so let's say I write that test, right? I write that test, it inserts a patient, and I check to see that the patient's there, and it is, and then it removes the patient, and the system is back mostly where it started.
00:59:49.000 --> 00:59:51.000
Aha.
00:59:57.000 --> 01:00:09.000
Okay, now I want to test inserting an encounter. So, in that code, in that fixture for that code, I have to repeat some of what I did… the fixture in my previous one. That is…
01:00:08.000 --> 01:00:09.000
That's right.
01:00:09.000 --> 01:00:13.000
inserting a patient. Okay, those two tests have nothing to do with each other.
01:00:13.000 --> 01:00:15.000
That's right.
01:00:14.000 --> 01:00:27.000
Right? Okay. Okay. I was sort of thinking of how to chain these tests together, so that the output of one test becomes some input for the next test. That doesn't sound like… the, the, the, the smart way to do it.
01:00:27.000 --> 01:00:28.000
Umm.
01:00:29.000 --> 01:00:31.000
For unit tests? Hmm.
01:00:31.000 --> 01:00:34.000
It absolutely isn't. That is correct.
01:00:33.000 --> 01:00:43.000
Okay, alright, alright. Oh, this is good. This is good. So that, you know, we just keep going, right? Obviously, my first test is not going to be whether I can do a payment or not.
01:00:43.000 --> 01:00:51.000
It's… it's gonna be, can I create the patient where I'm going to put the… the… the… the encounter, the char… the service, the charge, and then ultimately the payment.
01:00:51.000 --> 01:00:52.000
That's right.
01:00:51.000 --> 01:00:52.000
Okay.
01:00:53.000 --> 01:00:57.000
I can, I can, I can start to see how that could happen.
01:00:57.000 --> 01:01:00.000
And do all this with a testing framework.
01:00:57.000 --> 01:01:02.000
So… This is key, um…
01:01:00.000 --> 01:01:01.000
Don't.
01:01:03.000 --> 01:01:13.000
The whole reason I use tests is because they reduce friction and lead to more robust deliverables.
01:01:13.000 --> 01:01:14.000
Sure.
01:01:13.000 --> 01:01:27.000
If… They don't reduce friction. You need to figure out where you can apply something extra. It turns out that AI is one tool that's really good at writing tests.
01:01:26.000 --> 01:01:28.000
Mmhm.
01:01:27.000 --> 01:01:33.000
Except… AI, most AIs at this moment.
01:01:34.000 --> 01:01:37.000
When you say, hey, go test this piece of code.
01:01:37.000 --> 01:01:45.000
they will test the implementation. Bug for bug. If your implementation has some messed up bug in it.
01:01:46.000 --> 01:01:51.000
The test and AI by default is going to write.
01:01:51.000 --> 01:01:54.000
is gonna make sure that bug exists.
01:01:55.000 --> 01:01:58.000
You don't want that. So…
01:01:57.000 --> 01:01:58.000
No.
01:01:58.000 --> 01:02:04.000
AI, if it's part of your workflow, if it's a thing that you find acceptable.
01:02:04.000 --> 01:02:07.000
can make the writing the test part.
01:02:07.000 --> 01:02:18.000
Easy. Um… You do have to read the tests, just like you read everything. Anybody who contributes to your code or output.
01:02:13.000 --> 01:02:15.000
Yeah, yeah.
01:02:15.000 --> 01:02:16.000
Sure.
01:02:17.000 --> 01:02:19.000
Sure, sure.
01:02:18.000 --> 01:02:33.000
produces. Whether it's a co-worker, whether it's a person who works for you, whether it's AI, it doesn't matter. It's you. The buck stops here. And because the buck stops here, you.
01:02:33.000 --> 01:02:41.000
Read and understand and take responsibility for every line of code that gets into a release.
01:02:40.000 --> 01:02:43.000
I totally agree with you.
01:02:43.000 --> 01:02:45.000
Absolutely.
01:02:46.000 --> 01:02:48.000
So.
01:02:47.000 --> 01:02:48.000
Um…
01:02:48.000 --> 01:02:49.000
Okay.
01:02:49.000 --> 01:02:56.000
I, I, I think I have, uh, uh, an idea of how to do what we just talked about.
01:02:57.000 --> 01:03:02.000
Uh, you know, starting with the, with the first thing and then, and then, you know, keep building the tests.
01:03:02.000 --> 01:03:04.000
step at a time.
01:03:03.000 --> 01:03:11.000
And don't get complicated. Don't worry about an automated workflow yet. Don't worry about…
01:03:05.000 --> 01:03:06.000
Sure.
01:03:11.000 --> 01:03:15.000
"Do these tests fit the shape of food or bark?" Don't worry about that.
01:03:15.000 --> 01:03:23.000
Worry about writing a test that just tells you, hey, this works, or hey, it doesn't work.
01:03:23.000 --> 01:03:24.000
Okay.
01:03:25.000 --> 01:03:31.000
Okay, well, kind of like the, you know, the tests that I did write years ago for those utility functions.
01:03:33.000 --> 01:03:36.000
Once you can actually write a test.
01:03:36.000 --> 01:03:46.000
Then we'll worry about calling them automatically, and uh, gating your commits on them, and all that stuff, and that will be useful to you!
01:03:40.000 --> 01:03:41.000
Yeah, okay.
01:03:44.000 --> 01:03:45.000
Sure.
01:03:46.000 --> 01:03:47.000
Yeah.
01:03:46.000 --> 01:03:51.000
But that's not the thing that's in between 0 and 1.
01:03:51.000 --> 01:03:58.000
Yeah, I think… I think I, I've got a, a million unit tests to write, right?
01:03:58.000 --> 01:04:05.000
But the real interesting stuff will, for me, be the integration testing, the way all of our things talk together.
01:04:03.000 --> 01:04:05.000
It always is.
01:04:05.000 --> 01:04:11.000
It always is. But, remember, when you say, I've got a million tests to write.
01:04:05.000 --> 01:04:06.000
Yeah.
01:04:11.000 --> 01:04:16.000
That's a mountain in between you and, like, it being okay.
01:04:13.000 --> 01:04:17.000
Yeah, I know. I haven't written one.
01:04:16.000 --> 01:04:22.000
That's right, and that mountain is gonna be extremely discouraging.
01:04:17.000 --> 01:04:18.000
Yeah, yeah.
01:04:22.000 --> 01:04:30.000
Um, you gotta set… you gotta set your sights on one critical thing. Hey, can I test this?
01:04:22.000 --> 01:04:24.000
It's exactly what it is.
01:04:25.000 --> 01:04:27.000
That one.
01:04:27.000 --> 01:04:28.000
Yeah, I think so.
01:04:28.000 --> 01:04:30.000
Yeah.
01:04:30.000 --> 01:04:31.000
Yeah, you're right.
01:04:31.000 --> 01:04:36.000
And maybe the first bite of getting to that one critical thing?
01:04:36.000 --> 01:04:39.000
It's a single unit test.
01:04:39.000 --> 01:04:42.000
Uh, that seems simple. Uh-huh.
01:04:42.000 --> 01:04:54.000
and then it's 6 unit tests, and suddenly you can string them together, and it's an integration test. Maybe… maybe that's where you are. Did I already say that Selenium is essentially integration tests?
01:04:47.000 --> 01:04:49.000
Yeah, that's true.
01:04:50.000 --> 01:05:04.000
Okay, we… Yeah, okay. When you start doing integration tests, are you just using your unit tests, or do you write a whole new test to do the integration thing?
01:05:06.000 --> 01:05:16.000
Integration tests are like human beings. They're as different between each other as human beings are.
01:05:13.000 --> 01:05:14.000
Okay.
01:05:16.000 --> 01:05:20.000
There are integration tests that are you.
01:05:20.000 --> 01:05:23.000
Using unit tests?
01:05:23.000 --> 01:05:37.000
But it's more interesting, uh, when it does the thing you were thinking originally. One thing feeds into the next, feeds into the next, feeds into the next. Unit tests don't do that, because.
01:05:31.000 --> 01:05:32.000
Yes.
01:05:33.000 --> 01:05:35.000
Right.
01:05:36.000 --> 01:05:39.000
Right, they should clean up after themselves.
01:05:37.000 --> 01:05:43.000
In your case, um, if it takes patient.
01:05:43.000 --> 01:05:48.000
Insert patient to prove insert encounter works.
01:05:48.000 --> 01:05:51.000
Then if INSERT PATIENT doesn't work.
01:05:51.000 --> 01:05:59.000
Insert encounter never works Of course, that's true if we use a fixture also, but um.
01:05:53.000 --> 01:05:55.000
Right.
01:05:57.000 --> 01:05:58.000
Right, right.
01:05:59.000 --> 01:06:06.000
Uh, but ordered tests, which are reasonable in integration, aren't reasonable in unit tests.
01:06:06.000 --> 01:06:13.000
Because your focus won't be narrowed when you see a bug to the thing that actually is the bug.
01:06:12.000 --> 01:06:21.000
Right, because I can see if I, if I did some work on, um, on, uh, uh, refunding a patient, uh, refunding a, a payment, for instance.
01:06:22.000 --> 01:06:28.000
I don't want to get bogged down in… All the other parts to that, right?
01:06:27.000 --> 01:06:28.000
That's right.
01:06:28.000 --> 01:06:29.000
Yeah.
01:06:29.000 --> 01:06:32.000
Yeah. Okay, cool.
01:06:32.000 --> 01:06:34.000
Cool, see? You're teaching me something.
01:06:34.000 --> 01:06:37.000
Which, every day you teach me something.
01:06:36.000 --> 01:06:41.000
The goal is…
01:06:38.000 --> 01:06:43.000
Some days, some days you'll turn, you teach me two things.
01:06:42.000 --> 01:06:51.000
The goal is that… This is a tool that becomes easy to use.
01:06:51.000 --> 01:06:53.000
Sure.
01:06:51.000 --> 01:06:55.000
but has a big ROI.
01:06:55.000 --> 01:07:09.000
Right, okay. So, I've got a couple of terms here, I just want to make sure I understand them. Unit testing, we talked about that. Integration testing. Okay, end-to-end testing, is that integration testing?
01:07:09.000 --> 01:07:11.000
Um…
01:07:14.000 --> 01:07:16.000
Or do people not call it end to end?
01:07:14.000 --> 01:07:19.000
It happens that any end-to-end… Yes, it is.
01:07:19.000 --> 01:07:31.000
End-to-end testing is like… like a user story. It's a big thing. It's, does the whole thing work for this scenario?
01:07:25.000 --> 01:07:26.000
Yes.
01:07:26.000 --> 01:07:28.000
Yes.
01:07:31.000 --> 01:07:32.000
Right.
01:07:31.000 --> 01:07:32.000
Um.
01:07:32.000 --> 01:07:37.000
Integration testing might be smaller than an end-to-end test.
01:07:36.000 --> 01:07:37.000
Okay.
01:07:37.000 --> 01:07:38.000
Okay.
01:07:37.000 --> 01:07:54.000
Sometimes when you say end to end, it has a specific meaning like encrypted at rest, encrypted in transit, encrypted at rest again. That's not this meaning. What this meaning is, is it's the size of a user story of a scenario.
01:07:44.000 --> 01:07:46.000
Right.
01:07:46.000 --> 01:07:48.000
Right, right.
01:07:54.000 --> 01:07:56.000
Okay.
01:07:56.000 --> 01:07:59.000
Okay, then, uh, regression testing, what is that?
01:07:59.000 --> 01:08:09.000
Regression testing is the greatest thing in the world! A regression test is almost always a unit test, um…
01:08:03.000 --> 01:08:05.000
Okay.
01:08:08.000 --> 01:08:09.000
Okay.
01:08:09.000 --> 01:08:13.000
But, what normally what happens is, um.
01:08:13.000 --> 01:08:16.000
You see some bad behavior.
01:08:17.000 --> 01:08:30.000
And, uh… It might be hard, at first, to figure out exactly the conditions it takes to recreate that bad… reproduce that bad behavior.
01:08:30.000 --> 01:08:42.000
But as soon as you can reproduce that bad behavior, you can write a test. Now, that test… isn't yet a
unit test. It might be an integration test.
01:08:42.000 --> 01:08:49.000
Um, it might even be an end-to-end test. But it's something that fires when that bad thing happens.
01:08:49.000 --> 01:08:54.000
Now… that you know how to reproduce it, you can do that.
01:08:54.000 --> 01:08:59.000
debugging thing. Figure out where the actual bug is.
01:08:56.000 --> 01:08:57.000
Okay.
01:08:59.000 --> 01:09:00.000
Right.
01:08:59.000 --> 01:09:07.000
And that would let you narrow your new test down to something as small as a unit test.
01:09:07.000 --> 01:09:13.000
That new unit test you wrote for just this bug.
01:09:13.000 --> 01:09:15.000
It's a regression test.
01:09:15.000 --> 01:09:19.000
You're gonna turn it green with your fix?
01:09:19.000 --> 01:09:31.000
And as soon as it is green, and green forever, except not forever, um… You are ready for the next time it happens.
01:09:31.000 --> 01:09:38.000
You know, for instance, the bug is, you, um, were trying to validate email addresses.
01:09:38.000 --> 01:09:39.000
Huh-huh.
01:09:38.000 --> 01:09:45.000
But you didn't realize that a top-level domain could be two letters.
01:09:46.000 --> 01:09:57.000
So, when somebody's email address didn't end in .com, or .org, or .edu, you're like, well, that's not an email address.
01:09:52.000 --> 01:09:53.000
Right.
01:09:53.000 --> 01:09:54.000
Right.
01:09:56.000 --> 01:09:58.000
Right.
01:09:57.000 --> 01:10:11.000
That is why half the places I tried to register my email address with are like, I never heard of that! It's Christmas Island, you morons! Um… dot CX.
01:10:11.000 --> 01:10:15.000
Doesn't everybody use that? What about the crabs?
01:10:13.000 --> 01:10:14.000
No.
01:10:16.000 --> 01:10:19.000
Love the crabs.
01:10:16.000 --> 01:10:23.000
You write a regression test that says, hey, this was a valid, um.
01:10:23.000 --> 01:10:36.000
uh… URI, or email address, or whatever, URN, and uh… it didn't pass. Um… And you turned it green on the cases that you had.
01:10:36.000 --> 01:10:44.000
And then someday it turns red because somebody used a five letter TLD and.
01:10:45.000 --> 01:10:47.000
And now you know.
01:10:45.000 --> 01:10:48.000
Like dot store. Yeah, yeah.
01:10:47.000 --> 01:10:50.000
Yeah, a regression test.
01:10:50.000 --> 01:10:55.000
that sometime later turns red again.
01:10:55.000 --> 01:11:06.000
is one of the greatest feelings in the world. Because not only did you see something is wrong, and you saw it before the customer did.
01:11:07.000 --> 01:11:12.000
You saw exactly what was wrong and where.
01:11:14.000 --> 01:11:19.000
The key word there is before the customer found it.
01:11:18.000 --> 01:11:24.000
That's right. Regression tests that you have turned green.
01:11:24.000 --> 01:11:29.000
and then later you see red again, that is a test that has earned its keep.
01:11:26.000 --> 01:11:27.000
Yep.
01:11:29.000 --> 01:11:33.000
I… I… I can see that.
01:11:29.000 --> 01:11:33.000
Um, and I've got to remind you.
01:11:33.000 -->
01:11:38.000
that tests don't prove you don't have bugs.
01:11:37.000 --> 01:11:39.000
Right.
01:11:38.000 --> 01:11:43.000
But a red test proves you do have a bug.
01:11:43.000 --> 01:11:49.000
That's, that's like, that's like the number one thing to take away from this episode, right?
01:11:43.000 --> 01:11:45.000
so.
01:11:48.000 --> 01:11:59.000
I think it is. I mean, you know, they say the thing, and this is one of my favorite, favorite, um, expressions, experience is the thing that you get.
01:11:50.000 --> 01:11:51.000
Yah.
01:11:59.000 --> 01:12:09.000
when you didn't get what you wanted. That's actually a quote from Randy Pausch in Randy Pausch's last lecture. I hope I got his name right.
01:12:01.000 --> 01:12:02.000
Right, right.
01:12:03.000 --> 01:12:04.000
I loved it.
01:12:09.000 --> 01:12:22.000
Um, but the point is that, um, succeeding at something doesn't teach you anything. It's… that's the situation with entropy, where there's… there's no news.
01:12:19.000 --> 01:12:21.000
Yeah, yeah, we learned.
01:12:21.000 --> 01:12:25.000
Right, we learn from our failures. Yeah. Yeah.
01:12:22.000 --> 01:12:24.000
Failing at something.
01:12:24.000 --> 01:12:36.000
IS news. That IS a learning opportunity. So, green tests? Great. Fine. That's awesome. Uh, red tests? Yeah.
01:12:26.000 --> 01:12:28.000
Yeah.
01:12:28.000 --> 01:12:30.000
And it and it.
01:12:36.000 --> 01:12:39.000
Now I know what's wrong and I have something to fix.
01:12:36.000 --> 01:12:43.000
Yeah. And what do they say? If you're not failing, you're not trying hard enough.
01:12:42.000 --> 01:12:52.000
I actually have been thinking about that very thing in relation to practice and competition.
01:12:51.000 --> 01:12:53.000
Yeah, yeah.
01:12:52.000 --> 01:12:56.000
And I believe this, there's two modes.
01:12:56.000 --> 01:13:00.000
You need to practice right at the edge.
01:13:00.000 --> 01:13:09.000
You need to practice at the edge where, you know, 50% of your attempts, or 40% or whatever.
01:13:00.000 --> 01:13:02.000
Sure.
01:13:09.000 --> 01:13:19.000
failures, but they're only bad enough that you still understand why you failed, so you know what to work on.
01:13:19.000 --> 01:13:22.000
And then you go into the competition.
01:13:22.000 --> 01:13:34.000
And you do the thing that 90% of the time is gonna give you the best possible outcome based on your skills. So those numbers and those… that edge is always moving.
01:13:34.000 --> 01:13:40.000
Practice hard. Practice at the edge. Practice to learn.
01:13:40.000 --> 01:13:41.000
Compete?
01:13:41.000 --> 01:13:49.000
At a place where you're going to perform at your very best guaranteed performance.
01:13:49.000 --> 01:14:04.000
Well, what's the other saying? The difference between an amateur and a professional? The amateur works hard enough so that they can get it right. A professional works so hard they can't get it wrong.
01:14:07.000 --> 01:14:11.000
Right? Like a musician, for instance. Right?
01:14:10.000 --> 01:14:28.000
Uh-huh. Yeah, that's the… I thought I was gonna be a musician when I was young, and then I found out what it's like for a real musician, how hard they practice, how much they know about everything having to do with exactly the thing they're doing.
01:14:11.000 --> 01:14:17.000
They… Yes.
01:14:24.000 --> 01:14:25.000
Yep.
01:14:28.000 --> 01:14:30.000
Yep.
01:14:28.000 --> 01:14:50.000
And… I… that… that path for music and my instrument, which was the saxophone, um… That was… that did not have positive ROI for me. Um, on computers, it did. Um, but I will tell you, I am an old man, and to this day, and I think I said this to you before we started recording.
01:14:41.000 --> 01:14:42.000
Yah.
01:14:43.000 --> 01:14:44.000
Yep.
01:14:50.000 --> 01:14:59.000
Every single day, I learn more and more about just how much I don't know.
01:14:58.000 --> 01:15:00.000
Yep.
01:14:59.000 --> 01:15:01.000
about what I don't know.
01:15:00.000 --> 01:15:02.000
Yep, yep.
01:15:02.000 --> 01:15:06.000
But you, you're, you're learning. That's, that's.
01:15:06.000 --> 01:15:08.000
Always.
01:15:06.000 --> 01:15:18.000
That's the difference between you and an awful lot of people, right? There's a lot of people out there that are perfectly happy to be just exactly where they are, and you're moving forward, and that's good.
01:15:10.000 --> 01:15:11.000
I know.
01:15:18.000 --> 01:15:20.000
That's good.
01:15:19.000 --> 01:15:22.000
Jonathan Livingston Seagull.
01:15:22.000 --> 01:15:30.000
That… that is my role model. I don't… I don't know if you read it, but Jonathan Livingston Seagull, he's like, I just want to fly.
01:15:24.000 --> 01:15:25.000
Yeah.
01:15:26.000 --> 01:15:28.000
I have not.
01:15:30.000 --> 01:15:41.000
And every day, he just worked on how to fly better. And then, like, a crux of the book is… He goes up a level.
01:15:41.000 --> 01:15:46.000
Um, and to us, it looks like… Okay, I won't spoil it.
01:15:43.000 --> 01:15:49.000
Okay, don't spoil it. Don't… don't spoil it for me, because I should read that book. I… I…
01:15:48.000 --> 01:15:54.000
It's short. You can get through it in an hour. It's a great book. You should read it.
01:15:54.000 --> 01:16:05.000
I should, I am not a fast reader, but I mean, come on, it took me like five months to get through, what was the Asimov?
01:16:04.000 --> 01:16:07.000
The foundation. No, no, uh…
01:16:05.000 --> 01:16:14.000
The foundation. Yeah. Foundation. Yeah. It took me like five months to get through that. I enjoyed it, but.
01:16:12.000 --> 01:16:21.000
Well! I don't know exactly, but I… if I recall correctly, Jonathan Livingston's Seagull is, like, 60 pages long, maybe less?
01:16:20.000 --> 01:16:23.000
Ah, okay. I could do that.
01:16:23.000 --> 01:16:26.000
I could do that in a week.
01:16:27.000 --> 01:16:35.000
I'm not that slow. I tend to read late at night when I'm tired, and uh, you know, 4 pages in, I'm ready to sleep.
01:16:35.000 --> 01:16:38.000
But all right, what else do you
have to say about, yeah.
01:16:35.000 --> 01:16:39.000
Let me say two things before we let it go.
01:16:38.000 --> 01:16:40.000
Yeah, yeah.
01:16:39.000 --> 01:16:42.000
Um, first… And.
01:16:42.000 --> 01:16:45.000
We gotta be honest about the timeline.
01:16:45.000 --> 01:17:01.000
You… nobody, not you, not the listener, not… not people who don't listen, nobody, is gonna go from, um, zero task… they're not gonna go from you to me in… a day or a week.
01:17:01.000 --> 01:17:02.000
You're right.
01:17:01.000 --> 01:17:03.000
Maybe even a month.
01:17:03.000 --> 01:17:04.000
Umm.
01:17:04.000 --> 01:17:12.000
I have described tests as a thing you will hate on day two.
01:17:12.000 --> 01:17:17.000
And you will love and can't live without a year or two.
01:17:17.000 --> 01:17:24.000
Um, I think that probably, uh, conservatively.
01:17:24.000 --> 01:17:31.000
Uh, making… integrating tests into how you do your job, into your workflow.
01:17:31.000 --> 01:17:38.000
is like a 6-month job. It's not a thing you just do when you're not doing anything else.
01:17:38.000 --> 01:17:39.000
Right.
01:17:38.000 --> 01:17:55.000
It's a little slice, a little slice, a little slice, and you make it help you. And when it's not helping you, that means you're not making progress. So the real timeline is longer than you would hope. I don't want to promise you things that you can't achieve and would.
01:17:54.000 --> 01:17:56.000
Yeah, it's…
01:17:55.000 --> 01:17:58.000
would be discouraging.
01:17:56.000 --> 01:18:00.000
Yeah. It's, it's not instant gratification. I understand that.
01:17:59.000 --> 01:18:05.000
That's right. And then I saved out a couple of quotes.
01:18:05.000 --> 01:18:13.000
Um, that I think are interesting. Uh, the first test is the hard one. The hundredth is easy.
01:18:15.000 --> 01:18:19.000
If I rewrote the inside from scratch.
01:18:19.000 --> 01:18:22.000
Should this test still pass?
01:18:22.000 --> 01:18:29.000
That's the quote and in case you don't know what the answer is.
01:18:29.000 --> 01:18:34.000
If you rewrote the inside, but it still satisfies the promise.
01:18:34.000 --> 01:18:38.000
It better be that the test you wrote still passes.
01:18:38.000 --> 01:18:42.000
Because if it isn't, if it doesn't, you didn't write the right test.
01:18:39.000 --> 01:18:43.000
Right. Then the test doesn't represent the promise.
01:18:44.000 --> 01:18:52.000
Um, I've said this a couple times, but coverage tells you what you definitely didn't test.
01:18:44.000 --> 01:18:45.000
Right?
01:18:52.000 --> 01:18:56.000
It can never tell you what you did.
01:18:56.000 --> 01:19:06.000
Maybe we didn't talk about coverage. A lot of, uh, test packages will actually, um, do an analysis, generally by running.
01:19:06.000 --> 01:19:20.000
to see exactly which lines of your code under test, the implementation, were exercised by tests, and which weren't. And then it'll do that across the entire test suite.
01:19:11.000 --> 01:19:13.000
Ah.
01:19:20.000 --> 01:19:28.000
And it'll say, "Hey, you effectively tested 60% of the lines in your test.
01:19:28.000 --> 01:19:32.000
package, or library, or application, or whatever.
01:19:31.000 --> 01:19:32.000
Umm.
01:19:32.000 --> 01:19:37.000
But that tool, coverage, um… innie.
01:19:37.000 --> 01:19:44.000
In just… Um… It just tells you what you absolutely missed.
01:19:44.000 --> 01:19:48.000
The stuff it says you tested?
01:19:48.000 --> 01:19:59.000
That just means it's a thing that got exercised. It doesn't mean that you actually validated it and proved that it was correct.
01:19:56.000 --> 01:19:57.000
Right.
01:19:57.000 --> 01:20:01.000
Right, it may have run that line of code.
01:20:02.000 --> 01:20:07.000
But it doesn't tell you whether or not you checked for the right answers.
01:20:02.000 --> 01:20:03.000
Yes.
01:20:07.000 --> 01:20:16.000
Um… This might be maybe the most important, a test that has never been read.
01:20:17.000 --> 01:20:20.000
Has never done its job.
01:20:19.000 --> 01:20:21.000
The color red.
01:20:20.000 --> 01:20:27.000
In test-driven development, you want to see the test fail first.
01:20:21.000 --> 01:20:22.000
Yeah, yeah.
01:20:27.000 --> 01:20:35.000
Because it's only a failing test that proves, um… It is definitely triggered by the bad behavior.
01:20:35.000 --> 01:20:44.000
And then it's only that test turning green when it no longer has the bad behavior that proves the other side of the coin. You want both.
01:20:42.000 --> 01:20:44.000
Umm.
01:20:44.000 --> 01:20:47.000
And finally, test quantity.
01:20:47.000 --> 01:20:50.000
It's free now.
01:20:50.000 --> 01:20:57.000
That's the AI thing. If AI helps you write your tests, you can write as many tests as you need to.
01:20:52.000 --> 01:20:55.000
Oh, okay. Yeah.
01:20:57.000 --> 01:21:00.000
But quantity was never the problem.
01:21:00.000 --> 01:21:03.000
Uh, it's, it's not about…
01:21:01.000 --> 01:21:04.000
Quality of the… yeah.
01:21:03.000 --> 01:21:13.000
Yeah, it's not about having a thousand tests, it's about testing the four things that are absolutely critical to you delivering.
01:21:04.000 --> 01:21:05.000
Yah.
01:21:11.000 --> 01:21:13.000
Sure.
01:21:13.000 --> 01:21:14.000
Sure.
01:21:13.000 --> 01:21:15.000
A quality product.
01:21:15.000 --> 01:21:16.000
Okay.
01:21:16.000 --> 01:21:21.000
And I think, basically.
01:21:21.000 --> 01:21:26.000
That's all I've got to say, but my hope is, do you know.
01:21:26.000 --> 01:21:30.000
In your program, some, any of your programs.
01:21:30.000 --> 01:21:36.000
A place to start. A thing to test.
01:21:35.000 --> 01:21:44.000
You know, I'm probably going to do what we talked about. I'm going to do the create a patient, create an encounter, create a charge, that kind of a thing, just to get started.
01:21:44.000 --> 01:21:51.000
You know, then, you know, create an appointment, create, uh, cancel an appointment, reschedule an appointment, all those things.
01:21:44.000 --> 01:21:46.000
Okay.
01:21:50.000 -->
01:21:53.000
Would it be acceptable to you?
01:21:53.000 --> 01:21:56.000
If at our next recording.
01:21:56.000 --> 01:22:00.000
We check in and we see if you wrote that.
01:21:58.000 --> 01:22:12.000
Yeah, yeah, let's try. I can't guarantee at this point that'll be ready then, but I will absolutely go looking at the test framework for Pearl, and see if I can…
01:22:10.000 --> 01:22:14.000
And remember, all I'm saying is…
01:22:12.000 --> 01:22:14.000
understand what's required.
01:22:14.000 --> 01:22:15.000
The test.
01:22:15.000 --> 01:22:20.000
I'm not saying use the framework, I'm not saying stick it into anything.
01:22:15.000 --> 01:22:17.000
Yep.
01:22:19.000 --> 01:22:26.000
I understand. Yeah. Well, and I do have tests already. Yeah, I do have tests already, like I said.
01:22:21.000 --> 01:22:24.000
You do what you need to do.
01:22:26.000 --> 01:22:27.000
Okay.
01:22:26.000 --> 01:22:34.000
But, um… Yeah. Yeah. Well, let's talk about it next time. Let's see what I've done. Try to hold me accountable.
01:22:34.000 --> 01:22:36.000
I can't wait.
01:22:35.000 --> 01:22:49.000
Go ahead, try. That's it for you. Well, that's a lot. Yeah, we, uh, boy, we had a lot of fun on this conversation. Uh, of course, it went longer than I expected, but that's good, right? It's some good information. They all go…
01:22:36.000 --> 01:22:38.000
That's it for me.
01:22:38.000 --> 01:22:40.000
You want to wrap it up?
01:22:47.000 --> 01:22:50.000
See, you need to reset your expectations.
01:22:49.000 --> 01:23:01.000
I really do. They all… we've done this 35 times now, and they all go longer than I expected. But that's alright. I just need to change what I expect, right? My fear is then they'll go even longer.
01:23:01.000 --> 01:23:12.000
So anyway, that was a lot of fun. We didn't talk much about it at the beginning, but feedback, you can always send us feedback. Wolf, what's the email address for feedback?
01:23:12.000 --> 01:23:16.000
feedback at runtimearguments.fm.
01:23:16.000 --> 01:23:21.000
Ah.fm, one of those two-letter, uh, uh, top-level domains.
01:23:21.000 --> 01:23:23.000
That's right.
01:23:21.000 --> 01:23:39.000
That the email address test better deal with. Yeah, you can check out our show notes at the end of this podcast, or in your podcast player. There will be show notes, and we're gonna have a couple of links in there, and maybe a little summary.
01:23:37.000 --> 01:23:39.000
And the transcription?
01:23:39.000 --> 01:23:46.000
Uh, yeah, we do a transcript, um… Golly, what else? Is that it?
01:23:46.000 --> 01:23:49.000
I think, uh… I think I have…
01:23:47.000 --> 01:23:52.000
Do people care about contacting us directly on Mastodon?
01:23:52.000 --> 01:24:09.000
Yeah, we'll have the links in, um, the, the addresses in the show notes or on our website for that. Certainly Wolf and I are both on Mastodon. Uh, we're on, we, we send out our announcements on LinkedIn. I no longer send out announcements on Facebook because.
01:24:09.000 --> 01:24:19.000
It's Facebook, and I just… I can't bring myself to do it anymore. So, uh, yeah. Sorry, Merlin.
01:24:14.000 --> 01:24:16.000
Forgive us Marilyn.
01:24:19.000 --> 01:24:30.000
I think he understands. Anyway, it's been a blast, Wolf, and I'm looking forward to doing this again in a couple of weeks. As always, thanks for podcasting with me.
01:24:27.000 --> 01:24:28.000
Me too.
01:24:30.000 --> 01:24:35.000
Thank you and thank you everybody on the other end. Talk to you later.
01:24:35.000 --> 01:24:37.000
Goodbye.