4 ms·
My experience: I just started the process of converting our few hundred Test::Unit tests to Rspec simply because Test Unit documentation is terrible. Our tests
by criley 14y ago
My experience:
I just started the process of converting our few hundred Test::Unit tests to Rspec simply because Test Unit documentation is terrible. Our tests need a lot of work and I'm not that experienced at writing test scripts. I have to learn this as I do it, and I struggled to find resources for learning Test::Unit.
Every blog post, tutorial and guide I can find was written for Rspec.
As much as I'd love to continue using Test::Unit and save myself the hassle of converting from one to the other, I found learning Test::Unit to be one giant brick wall after another.
No one is discussing it, no one is blogging about it, no one is writing stack overflow questions about the issues. (I say, in a discussion about a blog post about it... but this is the exception not the rule, sadly)
For me it was a simple decision: If I want community support, I need to be using the tool the community is actually supporting.
(Not that Rspec documentation is that much better-- I've now resorted to just reading public github repos and looking for spec/ directories to scrutinize and learn from. If anyone has links to any good repos that use rspec tests, I'd love it if you could send them my way! I need more good repos to learn from!)
- rhizome 14y agoHear hear. I am dreading the technical debt I have in test-unit, and meanwhile the (Rails) world is moving on to Minitest and the world appears to be settling on Rspec syntax regardless. Nowhere to be found is even a conversion HOWTO, so test-unit starts feeling even more like a ghetto, and increases my conversion anxiety, which is all too bad, since I like what I consider to be the simplicity of test-unit.
- mapgrep 14y ago>I am dreading the technical debt I have in test-unit, and meanwhile the (Rails) world is moving on to Minitest Minitest and Test::Unit are part of the same package since 1.9, with Test::Unit implemented as a simple compatibility layer on top of Minitest: http://www.rubyinside.com/a-minitestspec-tutorial-elegant-spec-style-testing-that-comes-with-ruby-5354.html http://www.rubyinside.com/a-minitestspec-tutorial-elegant-sp... The Minitest assertions are quite similar to the old Test::Unit assertions, a large number are identical: http://rubydoc.info/stdlib/minitest/1.9.3/MiniTest/Assertions http://rubydoc.info/stdlib/minitest/1.9.3/MiniTest/Assertion...
- rhizome 14y agoRight, and I've seen many pages like the rubyinside one leaving me still hungry with questions like, "So, no more test_helper.rb or what?" Couldn't find that in either of those links. This is really more of a general documentation quibble on my part though, since I'm the dope who can't read through my questions and find the answers in the source (or wherever). I've been planning on making a blog post about 1:1 mapping of concepts between Test::Unit and Minitest learned from my own transformation, but as I've mentioned, I haven't been able to undertake that yet.
- mapgrep 14y agoThe docs really are lacking in this case; I expected the Test::Unit docs would document what's being stubbed and not in MiniTest but there's nothing there on that as near as I can tell. As a rule, I miss the thoroughness of CPAN/Perl docs. Some ruby packages have amazing docs but often I feel at sea, particularly with regard to high level overviews and examples.
- genericsteele 14y ago"For me it was a simple decision: If I want community support, I need to be using the tool the community is actually supporting." Truth. And the community is really split on this one. The side that makes the decisions about what goes into rails prefer unit tests, while a large chunk of the users prefer spec-based.
- richardjordan 14y agoThis was my experience too. I tried to use Test::Unit because I was learning from scratch, Rails 2.something, and Test::Unit was "The Rails Way". But I was fumbling in the dark. The community around RSpec picked me up and carried me to the testing promised land.
- evolve2k 14y agoThis. That was totally my experience too, after freaking out learning rails the friendly rspec syntax and natural readability felt like I'd reached a pub while lost in the desert.
- tamersalama 14y ago"because Test Unit documentation is terrible" Are you confusing Test Unit documentation with 'How/What to test' documentation? I can't think of any documentation required if what you use is a group of asserts. Test::Unit in a nutshell: `test "should do something"; ...; end` is what gets run in each of the files. `setup` is called before each test. `teardown` is called after each test. use `assert_*` at your discretion.
- rhizome 14y agoYou know, recently I had reason to look into the teardown method (DatabaseCleaner, dontchaknow), and I never did find anything conclusive that it was something that test-unit used. Sure, it was mentioned in many many DatabaseCleaner questions/answers/threads, but nothing I could really rely on since invariably these were also using Rspec. That is, my unanswered question was "Is teardown solely an Rspec thing?"