Replacing system tests with unit tests | Everyday Rails

14-Jun-2024 463
It’s amusing and affirming to me that system testing (in Rails) has been declared a failure. I could’ve told you that years ago! I’ve spent much of the past ten years working with test suites that are slow, brittle, and ultimately uninformative—almost always because they’re overly reliant on testing end-to-end.This article isn’t to say I told you so, though. Much of the pain I’ve felt from too many system tests was self-inflicted—either because I wrote the test myself, or because I suggested to someone else that they give it a try. So it’s one thing for me to tell you to reduce or replace your system tests with smaller ones—in this article, I’ll also give you some general guidance on how to do it. This advice comes from experience with Ruby on Rails, but if you’re using other languages or frameworks, and you’re clever, I bet it’s at least a little applicable to your situation.
Use coupon code:

RUBYONRAILS

to get 30% discount on our bundle!
Prepare for your next tech interview with our comprehensive collection of programming interview guides. Covering JavaScript, Ruby on Rails, React, and Python, these highly-rated books offer thousands of essential questions and answers to boost your interview success. Buy our 'Ultimate Job Interview Preparation eBook Bundle' featuring 2200+ questions across multiple languages. Ultimate Job Interview Preparation eBook Bundle