My aha! moment with test-driven development were acceptance tests and I recommend everyone who is still a skeptic to start there.
The Benefits of Acceptance Testing
Tomas Fernandez for Semaphore γ» Nov 18 '21
Many years ago I was working on a Ruby on Rails app with a multi-step booking process. Each step had many possible states and outcomes.
Testing that manually after every change in code was painfully repetitive, slow, and embarrassingly unreliable. π
Getting anything done was hard. Weβd change one thing, then spend about an hour on manual testing in the web browser to check if everything is still working.
Weβd often be surprised by the fact that we broke a seemingly unrelated use case. π€―
Sometimes weβd figure that out on our own, and sometimes weβd ship a new version to production and the client would email us about what had just stopped working.
Getting that kind of news felt the worst. It felt like we were wasting a lot of our clientβs and our own time. π
Then, we discovered Cucumber.
Very easy to get started. We could write a test once, and it would automatically launch a web browser, run the application, and do the work of feature verification instead of us.
That felt like magic! πͺ β¨
As soon as we started writing acceptance tests for a feature we had been working on, our development accelerated by an order of magnitude. π
We could add and change code without worrying that we would break something. π
When something did break, a failing scenario would let us know, and weβd quickly fix it before deploying a new version to users. π¦
So to all teams out there who don't write (much) tests, I Hundred points symbol recommend starting with acceptance tests.
The ROI β in peace of mind, reliability, velocity, and good feeling β of writing just a few is massive.
From that point on, it's really a downhill ride to adopting a test-driven mindset for all layers of code. πͺ
Originally published as a Twitter thread.
Top comments (1)
Sounds more like an aha moment for automated testing in general and nothing specifically to do with TDD.
Regardless, glad to hear you discovered the wonders of testing. Every dev that takes up testing helps make the ecosystem that much better for us all.