In this episode Kent C. Dodds, a full stack Javascript engineer at Paypal (as well as an instructor on egghead.io, Frontend Masters, Workshop.me and an open source enthusiast), discusses JavaScript test automation using tools like Jest and Cypress. Kent will also share best practices for developing software that is testable, as well as ways to help make testing part of your company’s culture.
About Kent C. Dodds
Kent C. Dodds works at PayPal as a full stack JavaScript engineer. He represents PayPal on the TC39. He's actively involved in the open source community. He's an instructor on egghead.io, Frontend Masters, and Workshop.me. He's also a Google Developer Expert. Kent is happily married and the father of four kids. He likes his family, code, JavaScript, Testing, and React.
Quotes & Insights from this Test Talk
- The thing that I love about Jest as that from the time that I use it the first time to now they iterated on the framework to make it this amazing testing platform. And so when you install Jest it comes with all of the capabilities of a bunch of tools that you don't really need to worry about integrating at all.
- The watch mode is this interactive experience in the terminal that is just something that's really a game changer for testing workflows especially if you're really into TDD. There's a lot of really cool things about those features. For example its capable of only running the tests that are relevant to the files you've changed since your last Git commit which is mind-blowing really awesome if you have hundreds or thousands of tests and in a project that take a long time to run it'll only run the ones that are relevant to your changes or you can filter it and run specific tasks whatever whatever you want to do or just run them all.
- I really am not a huge fan of Selenium. The only time that I've really spent with Selenium has all been associated with some painful memories. So Cypress was a breath of fresh air. So ever since I started or discovered Cypress about 2 years ago I think I haven't really looked at anything else. It's just such an amazing tool.
- From my perspective knowing how to code and having some API that I can code against is very different from having a good experience using that API. So the problem that I have with Selenium is just the limitations of the developer tools. That's one of the big problems that I have.
- I would argue that as far as testing tools are concerned one of the most important problems to solve is discovering the answer to what's broken and how do I fix it. You want to make finding an answer as short as possible so improving the developer experience is like a paramount objective of any testing tool and Cypress and Jest solves that problem.
- So I think that's my approach to becoming better or solidifying my understanding of anything. Is this process of consuming information building stuff with it or working with it and then teaching about it. So what my piece of actionable advice for you to be if you want to solidify your capabilities of testing is consuming information about it. I've got a lot of material online. I've got workshops that I have given and things like that that you can go look on my website for. But whatever you need to do to consume information about this material I think is useful. But don't stop there. You need to start implementing that. Whether that be in sight projects or in your work project or wherever or even just throwaway projects just to practice and then in that process of practicing you're going to learn a lot and so I recommend that the things that you learn should be shared with other people. And if you really feel uncomfortable sharing it you should at least write the blog post and don't post it but just do something to try and teach it because that is where you're really going to solidify your understanding of it and realize whether or not you actually understand it. When you start to try and teach it that's not really specific to testing. I apply that learning process to everything that I do and I find to be really valuable
Resources
- Here are some relevant blog posts mentioned during the show:but-really-what-is-a-javascript-test
making-your-ui-tests-resilient-to-change
effective-snapshot-testing
solidifying-what-you-learn
migrating-to-jest
testing–components-using-render-props
write-tests-not-too-many-mostly-integration - Workshops : https://kentcdodds.com/workshops/
Connect with Kent C. Dodds
- Twitter: @kentcdodds
- Blog: kentcdodds.com
- LinkedIn: kentcdodds
- YouTube: kentcdodds-vids
- Git: kentcdodds
- Company:
May I Ask You For a Favor?
Thanks again for listening to the show. If it has helped you in any way, shape or form, please share it using the social media buttons you see on the page.
Additionally, reviews for the podcast on iTunes are extremely helpful and greatly appreciated! They do matter in the rankings of the show and I read each and every one of them.
Test Talks is sponsored by the fantastic folks at Sauce Labs. Try it for free today!