There’s a neat little command you can add when you want to run the tests to your code. I use rspec, and you can type:
And what will happen is that the system will start running your tests and then freak out as soon as something fails. This is in contrast to running it without “fail fast”, which runs all your tests and then tells you a summary of what failed.
One of the benefits of fail fast is speedy iteration. If I catch something wrong early and I fix it, that fix might apply to later problems as well, hence saving time. Also, in a situation where you are striving for perfection - as we do with automated testing in programming - one fail is as bad as 50 fails, so you might as well know earlier than later that something is wrong.
During one of my idle moments of thinking and pondering, I extended this philosophy beyond testing code and into the realm of the real world. What if I added “fail fast” to my career?
Let’s say I was rejected by someone I reached out to professionally. Should I automatically regroup and change how I approached the person? Not really. Unlike coding, life operates more on statistics. You may have the best pitch in the world but you just happened to pitch the one person that will never like your idea. Better to gather more data points before calling in a fail. Sort of like:
Though we may never reach perfection - even 100% passing tests doesn’t mean you wrote all the right tests or tested correctly - fast iteration can be smart if done correctly.
So next time you hit a fail, rejoice! You’re about to save some time.