Test Driven Development

Embrace Failure with Test Driven Development using RSpec in Rails

A practical guide to help you get into the test (failure) driven development mindset using RSpec in Ruby on Rails

Adrian Teh
The Startup
Published in
9 min readApr 30, 2020

--

Background photo by Frederik Löwer on Unsplash

What is Test Driven Development, TDD

In short, test drive development or TDD is a development methodology by which tests are written before implementation code. Tests are written to fail and developers would work towards getting them to pass by writing the necessary code. This process is often described as the “Red, Green, Refactor” cycle.

“Writing tests is a waste of time”

That’s what I thought when I first learned to write tests. I was a freelance developer when I started. I was cash strapped and the last thing I needed was more work to get things done. Writing tests to me wasn’t only a concept that was hard to grasp, it was taking twice as much effort for me to get anything done. So, why do people even write tests?.

It wasn’t until I started building large applications with a team of engineers that I finally grasped the essence and importance of writing tests.

The “Why” is important

--

--

Adrian Teh
The Startup

Founder. Product Builder. Full Stack Engineer (Ruby on Rails + React) - http://adrianteh.me