Assert

Test::Unit style testing framework, just better than Test::Unit.

What Assert is

  • Framework: you define tests and the context they run in - Assert runs them. Everything is pure ruby so use any 3rd party testing tools you like. Create 3rd party tools that extend Assert behavior.

  • *First Class*: everything is a first class object and can be extended to your liking (and should be)

  • MVC: tests and how they are defined (M) and executed © are distinct from how you view the test results (V).

  • *Backwards compatible*: (assuming a few minor tweaks) with Test::Unit test suites

What Assert is not

  • Rspec

  • Unit/Functional/Integration/etc: Assert is agnostic - you define whatever kinds of tests you like (one or more of the above) and assert runs them in context.

  • Mock/Spec/BDD/Factories/etc: Assert is the framework and there are a variety of 3rd party tools to do such things - feel free to use whatever you like.

Description

Assert is a Test::Unit style testing framework. This means you can write tests in Assert the same way you would with Test::Unit. In addition, Assert adds some helpers and syntax sugar to enhance the way tests are written - most taken from ideas in Shoulda and Leftright. Assert uses class-based contexts so if you want to nest your contexts, use good old inheritance.

Assert is tested using itself. The tests are a pretty good place to look for examples and usage patterns. In addition (TODO) check out the wiki and ./examples in the source.

Installation

gem install assert

Usage

require 'assert'

class MyTests < Assert::Context

  def test_something
    assert_equal 1, 1
  end

end

The Assert family of testing tools

These are all tools that use and extend Assert. If you write your own, share it with us and we will post it here.

(TODO)

Contributing

The source code is hosted on Github. It’s clean, modular, and easy to understand. Feel free to submit pull requests and file bugs on the issues tracker.

One note, however: please respect that Assert itself is intended to be the flexible, base-level type logic that should change little if at all. Pull requests for niche functionality or personal testing philosphy stuff will likely not be accepted.

If you wish to extend Assert for your niche purpose/desire/philosophy, please do so in it’s own gem (named ‘assert-<whatever>’) that uses Assert as a dependency. When you do, tell us about it and we’ll add to the Family of tools.

License

Copyright © 2011 Kelly Redding, Collin Redding, and Team Insight

Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the “Software”), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:

The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.

THE SOFTWARE IS PROVIDED “AS IS”, WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.