https://kentcdodds.com/blog/make-your-test-failHello there friends. I'm just driving now. I was thinking about a blog postthat I wrote a while ago. I think it was called break your tests orsomething like that, but the idea is that it's just really easy to write atest that passes and so you feel really good about it this this especiallyhappens if you're testing after you've already implemented something ifyou're doing TDD this is maybe less of a problem, but it's really easy towrite a test that's green and we're happy with it and,So we commit it andwe move on and then we later find out that that test wasn't running tocompletion or it was the it wasn't testing what we thought it was testingwasn't making the right assertions or something and so it wasn't actuallydoing what we thought it was and so then the thing that we were intendingto test ends up breaking in that test doesn't doesn't save us from that andso what I suggest that you do is you take the time to actually try and makethe thing that you're testing break, so you simulate a failure this couldbe.I'm pretty much like any any step of the process of what it is that you'retesting maybe you're making a request to get some data and then you'redisplaying that data in your asserting that the data is displayed properlyand so you could just comment out the code that updates the state orsomething like that and so it's normally very easy and it's a manual check.I don't think that there would be a whole lot of use in like at this pointyou're testing the tests and I don't see a whole lot of benefit and likehow far do you go, do you test the test the test the test?It's just sorrycracking myself up um yeah so like at some point you have to say okay,we're good with just doing a manual verification of this and so that'sthat's what this is is just a manual verification that yes this is indeedtesting what I think it is and I verified that by commenting out theimplementation or changing the implementation and in a certain way to makesure that the test will catch me if I mistakenly change the implementationin this way, so yeah, as you're writing your test for your software, Isuggest that you break the test and I will.Add a link to the blog post where I dive into this little in a little bitmore detail at the top of the notes for this episode so you can go take alook at that. I hope you have a wonderful day and we will chat with youlater bye.
Podchaser is the ultimate destination for podcast data, search, and discovery. Learn More