Pros and Cons Of Different Testing Frameworks

Hello and happy holidays!

I am working on a side project and am currently in the planning stages I was considering popular testing tools like MiniTest and RSpec for my application needs and wanted to know what the discuss community thought of the Pros and Cons of each framework.

I appreciate any insights folks want to drop on this since this is my first time building a RoR app.

For some context:

  • This will not have significant UI components or views and will serve as a REST API for another application.
  • I am not profoundly skewed or religious towards any particular line of thinking when it comes to building things, but happy to hear the perspective of folks who are and the potential benefits.
  • If there any lesser known tools that I might want to give a shot I’d be happy to hear about them!

Having used rspec for ~8 years and now minitest for ~3, I must say I do not expect to be going back. Minitest is just so much simpler, and in my view enforces better testing practices. I do not miss let! or nested describe/context blocks. I prefer putting helpers in a def and having my test code look pretty much like “normal” code

1 Like

I’ve only ever used RSpec, which is easy to write, but it has more of a learning curve to to it’s DSL. It also makes it so easy to mock/stub code that one can accidentally mock away the code you’re trying to test if you’re not careful.

As to your second bullet point - I don’t know if it’s specifically about testing in Rails, but if it’s general programming then I’d suggest trying to follow the Rails conventions until it clicks. I’ve seen a lot of code that looks like someone didn’t make the effort to understand the language/framework and tried to apply the conventions & practices that they’re used to from other languages, which I’ve always thought made onboarding & maintenance harder. I think that most of the things that Rails comes with out of the box is enough to hit the ground running for a lot of use-cases.

1 Like