I’m pleased to announce BareTest 0.2.
BareTest is a new test framework. I started writing it for mainly 2
- I disliked the undescriptive way you have specify tests in vanilla
(def test_bla), compared to the much more descriptive way you do it in
rspec (it “should have a very nice description”)
- I was pretty sure a decent test framework could be written in under
of code (and the first version of baretest, written on the flight home
railsconf09 in vegas, was indeed a whopping 37 lines of code)
By this version, baretest has gotten some - to my knowledge - unique or
rare features. Those include:
- Very straightforward and terse assertions (just a block whose return
- Various helpers to write assertions with better diagnostic messages
more complex tasks like raising, throwing, float imprecision,
- Easy grouping of assertions into suites.
- BDD style specifications/test descriptions (NOT code) that can be
without running the testcode.
- An interactive mode, letting you examine what went wrong in a
test within an irb session, bound to the context of the assertion that
showing you the full code of the assertion, even including it in the
history of that irb session.
- An uncomplicated way to write pending assertions, have dependency
skip certain suites/assertions.
- A colored shell formatter, diagnostic-, XML- and TAP formatter.
- Adding your own formatters is trivial - a module with 4 methods to
average formatter shipped with baretest is between 20 and 50 lines.
- An API to use it from code, such as rake tasks (includes an example
- A ‘baretest’ executable to run tests on multiple files at once, using
layout convention to reduce require- and
How to quickly try baretest without installing it:
- Download from github and unpack (or clone) - download link:
- Change into the baretest directory:
- Run the examples:
That’s it. Alternatively you can run baretest’s own tests, and/or play
./bin/baretest -f tap
gem install baretest(you may have to run
sudo gem install baretest)
- There is no 2.
Installing baretest edge
- Download from github (or clone)
rake gem:install(you may have to run
sudo rake gem:install)
Note for users with multiple ruby installations: the rake task will try
the right gem executable. You can force it to use a specific one by
the GEM env variable, e.g.:
rake gem:install GEM='gem1.9'
- In your project directory, run
baretest --init, which will create a
directory with all the basic stuff already in it.
- Write your tests
- Run them using
baretestin the toplevel directory of your project.
That’s all folks.
Looking forward to your feedback and hope you enjoy baretest
Stefan R., aka apeiros