trial and errors are key to building anything new and innovative.
It’s almost unanimous in the articles and studies on the internet these days: Test-driven development (henceforth, TDD) is the way developers should be creating everything. But if you’re like me, getting started is a lot harder than it sounds.
This is the first of maybe a couple of posts that I am going to be doing on testing React components and TDD in general. This one deals with setting up the Jest and Enzyme libraries and then writing a couple basic tests for a Login component. In my next posts hopefully I’ll go into a little more detail about these libraries and about how we can test more complex components that involve Redux. So with that let’s get started!
On my journey on Microverse, one of the things that troubled me the most to understand was RSpec, a Ruby gem for Test-Driven Development. The concept is quite simple. You create tests as you code along, so in the future, if an update breaks something, it will be easy to notice because one or more tests will fail.
When we start developing an app we usually do it the old fashion way: we get an idea, we elaborate on it, we make a plan to develop an app then we start coding and in the end, we test if our app is working properly.
Photo credit, HackerNoon AI