Small, fast testing library for Ruby: unit tests, specs and benchmarks
open sourceMITfree
Minitest is a complete suite of testing facilities for Ruby: minitest/test, a small and fast unit testing framework with a rich set of assertions; minitest/spec, a spec engine that maps those assertions onto expectations; minitest/benchmark, which asserts an algorithm's performance; and a Rake task generator. It sticks to plain Ruby (classes, modules and methods) rather than a DSL, so tests read as ordinary code. Rails depends on it (Active Support and more), and Rake, RDoc and Nokogiri use it too. It's written by Ryan Davis of seattle.rb.
Problems it solves
- a small, fast test framework for my Ruby code that's just plain Ruby
- write unit tests for a Ruby gem without learning a DSL
- write spec-style tests in Ruby without pulling in RSpec
- check in a test that my algorithm stays linear as the input grows
- run my Ruby tests in a random order to catch ones that depend on each other
- run only the tests whose names match a pattern
Features
- minitest/test: unit tests with a rich set of assertions
- minitest/spec: describe/it specs with expectations, built on the same assertions
- minitest/benchmark: assert an algorithm's performance curve
- minitest/test_task: a Rake task generator, with parallel runs (MT_CPU)
- random test order with a reproducible seed, name filters and exclusions
- plugins and custom reporters found through RubyGems
- minitest-focus: run only the tests you mark with focus, without command-line arguments
Limitations
- Supports only the Ruby versions that aren't end of life (Ruby 3.2+ today).1
Alternatives
The same job
These do what Minitest does.
- RSpec Behaviour-driven testing framework for Ruby
- test-unit An xUnit family unit testing framework for Ruby
- Combustion Test Rails engines without a full Rails app in your test folder
- ZenTest Ruby testing tools: zentest, unit_diff, autotest and multiruby
