/tack

A Rack-inspired interface for testing

Primary LanguageRubyMIT LicenseMIT

tack

USE AT YOUR OWN RISK. This is highly experimental and the interface is changing rapidly.

Here is a basic example of where this is going.

# A really early look how Tack runners might be constructed. Everything in this example may change since the code is really new.

runner = Tack::Runner.new(:root => Dir.pwd) do |runner|
  runner.use Tack::Reverse if options[:reverse] # Optionally reverse the order of tests
  runner.use Tack::Shuffle if options[:shuffle] # Optionally shuffle the tests
  runner.use Tack::Formatters::Profiler, # Write out some profiling info
    :tests => options[:profile_number].to_i if options[:profile_number]
  runner.use Tack::Formatters::TotalTime # Display the total running time
  runner.use Tack::Formatters::PrintFailures
  runner.use Tack::Formatters::BasicSummary # e.g. 5 tests, 2 failures, 0 pending
  runner.use Tack::Formatters::ProgressBar
end

set = Tack::TestSet.new

# Get the tests. Tests are currently represented like so:
# [["foo_test.rb", "test_one", "foo_test.rb", "test_two"]
# This will have to get more complicated as I add support for
# contexts
tests = set.tests_for(options[:paths], Tack::TestPattern.new(options[:pattern]))

runner.run(tests) # Run the tests

Note on Patches/Pull Requests

  • Fork the project.

  • Make your feature addition or bug fix.

  • Add tests for it. This is important so I don’t break it in a future version unintentionally.

  • Commit, do not mess with rakefile, version, or history. (if you want to have your own version, that is fine but

    bump version in a commit by itself I can ignore when I pull)
  • Send me a pull request. Bonus points for topic branches.

Acknowledgements

Tack is heavily inspired by Rack and Faraday and borrows ideas and code from both. Also, initial versions of the Test::Unit and RSpec adapters borrowed code from Hydra while a lot of the formatter code was taken from RSpec.

Copyright © 2010 Ben Brinckerhoff. See LICENSE for details.