minitest version 5.0.0 has been released!
- home: https://github.com/seattlerb/minitest
- rdoc: http://docs.seattlerb.org/minitest
- vim: https://github.com/sunaku/vim-ruby-minitest
minitest provides a complete suite of testing facilities supporting
TDD, BDD, mocking, and benchmarking.
"I had a class with Jim W. on testing last week and we were
allowed to choose our testing frameworks. Kirk H. and I were
paired up and we cracked open the code for a few test
frameworks...
I MUST say that minitest is *very* readable / understandable
compared to the 'other two' options we looked at. Nicely done and
thank you for helping us keep our mental sanity."
-- Wayne E. Seguin
minitest/unit is a small and incredibly fast unit testing framework.
It provides a rich set of assertions to make your tests clean and
readable.
minitest/spec is a functionally complete spec engine. It hooks onto
minitest/unit and seamlessly bridges test assertions over to spec
expectations.
minitest/benchmark is an awesome way to assert the performance of your
algorithms in a repeatable manner. Now you can assert that your newb
co-worker doesn’t replace your linear algorithm with an exponential
one!
minitest/mock by Steven B., is a beautifully tiny mock (and stub)
object framework.
minitest/pride shows pride in testing and adds coloring to your test
output. I guess it is an example of how to write IO pipes too.
minitest/unit is meant to have a clean implementation for language
implementors that need a minimal set of methods to bootstrap a working
test suite. For example, there is no magic involved for test-case
discovery.
"Again, I can't praise enough the idea of a testing/specing
framework that I can actually read in full in one sitting!"
-- Piotr S.
Comparing to rspec:
rspec is a testing DSL. minitest is ruby.
-- Adam H., "Bow Before MiniTest"
minitest doesn’t reinvent anything that ruby already provides, like:
classes, modules, inheritance, methods. This means you only have to
learn ruby to use minitest and all of your regular OO practices like
extract-method refactorings still apply.
Changes:
5.0.0 / 2013-05-10
Oh god… here we go…
Minitest 5:
Deaths in the family:
- MiniTest.runner is dead. No more manager objects.
- MiniTest::Unit#record is dead. Use a Reporter instance instead.
- MiniTest::Unit.run* is dead. Runnable things are responsible for
their own runs. - MiniTest::Unit.output is dead. No more centralized IO.
Major (oft incompatible) changes:
- Renamed MiniTest to Minitest. Your pinkies will thank me. (aliased to
MiniTest) - Removed MiniTest::Unit entirely. No more manager objects.
- Added Minitest::Runnable. Everything minitest can run subclasses this.
- Renamed MiniTest::Unit::TestCase to Minitest::Test (subclassing
Runnable). - Added Minitest::Benchmark.
- Your benchmarks need to move to their own subclass.
- Benchmarks using the spec DSL have to have “Bench” somewhere in
their describe.
- MiniTest::Unit.after_tests moved to Minitest.after_tests
- MiniTest::Unit.autorun is now Minitest.autorun. Just require
minitest/autorun pls. - Removed ParallelEach#grep since it isn’t used anywhere.
- Renamed Runnable#name to Runnable#name (but uses @NAME
internally). - Runnable#run needs to return self. Allows for swapping of results as
needed.
Minor moves:
- Moved Assertions module to minitest/assertions.rb
- Moved Expectations module to minitest/expectations.rb
- Moved Test to minitest/test.rb
- Moved everything else in minitest/unit.rb to minitest.rb
- minitest/unit.rb is now just a small (user-test only) compatibility
layer. - Moved most of minitest/pride into minitest/pride_plugin.
- minitest/pride now just activates pride.
- Moved ParallelEach under Minitest.
Additions:
- Added a plugin system that can extend command-line options.
- Added Minitest.extensions.
- Added Minitest.reporter (only available during startup).
- Added Minitest.run(args). This is the very top of any Minitest run.
- Added Minitest::Reporter. Everything minitest can report goes through
here.- Minitest.reporter is a composite so you can add your own.
- Added Minitest::CompositeReporter. Much easier to extend with your own
reporters. - Added UnexpectedError, an Assertion subclass, to wrap up errors.
- Minitest::Test#run is now freakin’ beautiful. 47 → 17 loc
Other:
- Removed Object.infect_with_assertions (it was already dead code).
- Runnables are responsible for knowing their result_code (eg “.” or
“F”). - Minitest.autorun now returns boolean, not exit code.
- Added FAQ entry for extending via modules. (phiggins)
- Implement Runnable#dup to cleanse state back to test results. Helps
with serialization. pair:tenderlove - Moved ParallelEach under Minitest.
- Runnable#run needs to return self. Allows for swapping of results as
needed. - Minitest.init_plugins passes down options.
- Minitest.load_plugins only loads once.
- Fixed minitest/pride to work with rake test loader again. (tmiller)
- Added count/size to ParallelEach to fix use w/in stdlib’s test/unit.
(btaitelb)
Voodoo:
- Removed mutex from minitest.rb (phiggins)
- Removed mutex from test.rb (phiggins)
- Removed Minitest::Reporter.synchronize (phiggins)
- Removed Minitest::Test.synchronize (phiggins)
- Upon loading minitest/parallel_each, record, capture_io and
capture_subprocess_io are doped with synchronization code. (phiggins)