Some common struggles people have with testing, and things you can do to improve.
The argument is long ended: You should be testing your mission-critical code.
Everyone accepts that testing code now is better than waiting for users to complain later.
Everyone agrees that the testing should be automated.
Pretty much everyone’s had a situation where tests saved them from a production bug…or would have saved them if tests had been in place.
But there’s still a struggle. The other day I asked on twitter what you all struggle with around testing. The struggle comes when you’re trying to determine what to test, how much time you have to test, what granularity to test, what to mock and what to keep real, or just the daunting task of setting up good testing tools and testing environments. Or the frustration might creep in when you find yourself writing the same code in two places. 🤪
Another big source of frustration with testing—stop us if you’ve heard this one before—is when you have to basically rewrite your tests every time you touch the code it’s testing. Once you pick your head up off your keyboard, you have to ask yourself: “Ok… so why are we testing again? This is just adding friction to shipping code.” It’s extremely frustrating when you refactor a component and your test breaks. 😡 I wouldn’t want to write tests either.
When I got started with testing years ago, I struggled. I struggled hard. I’ve spent countless hours learning, building, and rebuilding tools. I even gave a full hour talk called “ES6, Webpack, Karma, and Code Coverage”. It took a full 60 minutes to explain how to make these tools play nicely together. It took dozens more hours behind the scenes to figure out what I explain in that talk.
But I was committed to figuring out and helping build the best way to do this. I needed it, and I know my fellow developers need it too.
Struggle and frustration don’t have to be your experience. You don’t have to spend dozens of hours to figure out how to get testing set up in your codebase. I’ve already done that for you. And the tools have improved, and I can show you how to use them. There are techniques I can teach you that will alleviate the pain and struggle you’re having with getting the confidence you’re looking for out of your testbase.
Here’s tip for you to take to the next time you test your code that’ll help you answer the question of “what do I test?” Follow this process:
With the tools and techniques I’m going to show you, this process will become a natural habit. 💯
Stop the struggle. Follow me.
P.S. Stay tuned, because over the next couple weeks I’ll share more strategy and tactics for getting your testing skills up to date.
Things to not miss:
react-suspense-starter: If you haven’t had a chance to checkout suspense yet and play around with it, check this out :)
Some tweets from this last week:
> Friends… I’ve never been more excited about the future of React than I am right now. > > This train has just left the station y’all! 🚂– Oct 7, 2018
> First class API for code splitting built-into React!!! 💯⚛️ > > YEEEEEEESSSSSSSSSSS!!!!! #ReactJS #FrameworkSummit > > > – Oct 2, 2018
> Scenario: someone comes to you and laments hope difficult an experience they’re going through is. You’ve been through that and way harder things in your opinion. You can either related and validate or tell them they haven’t even begun to suffer. Your response says much about you. – Oct 3, 2018