I find behavior-driven development (BDD) more effective than TDD — which tends to lend itself to…
Josh Habdas
74

My “BDD” tests for React start at the react component level. The conversations, stories created together with QA, the team, etc. are what drives me to create my react component unit tests. Those are my BDD tests. I then drop down to reducer & action unit tests on the front end coupled with lower-level unit tests on the backend that in the end, ultimately make my React BDD unit tests pass. That’s how I do it and it’s working really well for me. The outside-in cycle works great for me.

I then come back around and slap on casper tests at the end, because those are integration tests. I don’t view those as “BDD” tests..and use the casper tests only to test happy paths of the application which means if I want to test the react component tree, I don’t do that at the unit level. My React Unit tests are isolated to the component in which they test. They don’t dive deep down into a bunch of child components of a component for example. That’s more integration testing to me.

Like what you read? Give Dave Schinkel a round of applause.

From a quick cheer to a standing ovation, clap to show how much you enjoyed this story.