Some common myths around testing and what the reality is…
Today is my birthday!!!
I’m celebrating a few ways. First, I invited folks on Twitter to do two things:
Please join in (if you haven’t already)!
The other way I’m celebrating is by sharing a few UI Testing Myths with you. Let’s get started!
This is actually a truth… if the tests are written incorrectly. If your test is testing implementation details, then of course they’ll break when the implementation changes! But your user doesn’t care about the implementation details. In fact, they don’t even care whether you’re using React, Angular, or jQuery. So for the most part, your tests shouldn’t care about that either. 💯
The conventional wisdom of testing components that use Redux is that you should test the component in isolation from Redux, and then test the Redux action creators and reducers separately.
But if you do this, your tests can’t give you any confidence that your components communicate properly with Redux.
Instead, you can actually test your connected component with your real Redux store. Do this, and you’ll get the confidence that your component is rendering properly, and that the Redux action creators and reducers are all working together in tandem. Just like they will in production. ✅
This, too, can be true if the tests are written incorrectly. A common mistake I see in E2E testing is doing the same things in every test—for instance, every test going through the whole registration and login flow before doing whatever is needed for the test. When you do stuff like this, you start seeing a lot of duplication, and that’s when you start creating things like “page objects” (which is a poor practice). 😐
I can’t tell you how excited I am to share this course with you.
Make sure to tune in to tomorrow’s livestream starting at 11:30am ET. It’s going to be a good one! And check out yesterday’s Q&A, which was really awesome! Lots of great stuff in there (including a little preview into what the course topics are)!!
Today’s blog post is “Eliminate an entire category of bugs with a few simple tools”. It’s the published version of my newsletter from ~2 weeks ago. If you thought it was good, go ahead and give it some claps (👏x50) and a retweet: