I've been using Rspec extensively at work for a large Rails application, but have been using Minitest on my pet projects. I like both, and can see pros and cons of each.
I'd like to know what others in the community use, what they prefer and why.
I've been using Rspec extensively at work for a large Rails application, but have been using Minitest on my pet projects. I like both, and can see pros and cons of each.
I'd like to know what others in the community use, what they prefer and why.
For further actions, you may consider blocking this person and/or reporting abuse
H A R S H H A A -
Bruno Ciccarino Ī» -
Sukhpinder Singh -
Lucas M. -
Top comments (7)
Here are some of my opinions about both frameworks.
Rspec
Pros
Cons
Minitest
Pros
Cons
I totally agree about the matrix of scenarios. I'm still not satisfied with contexts in Rspec because of the nested nature. This is somewhat mitigated by shared examples, but still.
Excellent comparison list!
FWIW, there are shared contexts too, as you probably know. I'd sometimes make a regular loop outside of the context in order to repeat tests over some values. And helper functions are often handy, and multiline
let
s.Beyond that, IME you just get to a point where they're dry enough and let it go. Since they're tests, they're not likely to need much maintenance, and what they do is often repetitive by nature.
Overall, I like the RSpec DSL... my main gripe was that there are two versions of it, so it's possible for a codebase to have a mix of styles. Probably not an issue for projects started after version 3 came out, though.
I haven't used minitest much, but I will say that I'm not a huge fan of structuring tests as classes (a la their "unit test" style, or Python's built-in
unittest
, or the various xUnit frameworks).Running tests by line number is a nice feature of RSpec's but I've tended to use the substring filter more anyway, and it looks like minitest has one. (Often the line number changes as you make changes to the file.) Had I not been running my Ruby app inside a VM, I'd probably have made more use of editor integration there anyway.
Also it's hard to overstate the importance of faster test runs :p
In my heart I'm still a fan of minitest's simplicity. RSpec's DSL is powerful but it can be... too much.
Hi ! You can try Tomty - generic testing framework. You could write tests on many languages including Ruby if you really into Ruby influenced testing ...
I've only used rspec really
Since you've used both, what do you like about minitest?
Good question. Some things I like about minitest,