A two-parter with a quick intro. Intro: I'm coming to Ruby from Perl, and I'm a bit lost among the test framework choices. I understand that there is probably no single, all-around best choice, but I can't even get a clear picture of the playing field.
So, first, MiniTest or Test::Unit? I just realized that 1.9.1 defaults to MiniTest now. I hadn't noticed since all the older Test::Unit tutorials still work fine. If you require test/unit
, you actually get MiniTest as a Test::Unit emulator (!). My initial thought was to go with the default choice of MiniTest (once I knew it was there), but even very recent books don't seem interested in teaching it. Ruby Best Practices says "There are significant differences" between the two, but he chooses not to deal with them. He also runs all his tests via Test::Unit (plus some custom add-ons). The new Pickaxe also has very little about MiniTest per se, and in the chapter on testing they also use the Test::Unit emulation version of MiniTest. To clarify my first question then: is MiniTest a poor first option? Should I default to using the Test::Unit emulator?
Second, beyond the built-in options, there are Rspec, Cucumber & company for behavior driven tests. Is the community tilting strongly towards this style and this framework? Should I just start with Rspec?
I will play a bit with all three, but I'm curious to hear what kind of consensus (if any) is forming around testing in Ruby 1.9.
(A quick follow-up, as a reminder to myself and for anyone interested. See this link for a useful overview of the different invocations for Test::Unit and MiniTest in the various Rubies 1.8 to 1.9.1.)