0.0
No commit activity in last 3 years
No release in over 3 years
A testing framework for concisely sharing several stages of setup code across tests.
2005
2006
2007
2008
2009
2010
2011
2012
2013
2014
2015
2016
2017
2018
2019
2020
2021
2022
2023
2024
 Dependencies

Runtime

~> 0.7
 Project Readme

TestGarden

A garden of forking tests.[1]

TestGarden is a testing framework for concisely sharing several stages of setup code across tests. The shared code is executed once for each test that needs it. Tests may be nested to any depth.

TestGarden generates summary output, reporting how many pass, fail, skip, and error cases were detected for each group of tests. TestGarden assumes assertion failure exceptions are generated by Wrong::Assert#assert.

Installation:

gem install 'test-garden'

Synopsis:

require 'test-garden'

test Thing do
  thing = Thing.new; teardown {thing.cleanup()}
  assert {thing.ok?}

  test "assign foo" do
    thing.foo = "baz" # does not affect foo in subsequent tests
    assert {thing.foo == "baz"}
  end

  test "compare foo in two instances" do
    thing2 = Thing.new; teardown {thing2.cleanup()}
    assert {thing.foo == thing2.foo}
  end
end

Run the test like so:

ruby test_thing.rb [-v | --verbose] [topic topic ...]

If no topics are given, the verbose output is:

T: Thing
T: Thing: assign foo
P: Thing: assign foo
T: Thing
T: Thing: compare foo in two instances
P: Thing: compare foo in two instances
  2 passed,   0 failed,   0 skipped,   0 errors in Thing

If a topic list is given, it is treated as a sequence of regular expressions. Only tests whose topic path matches those regular expressions, one for one, are executed. (Matching is case insensitive.) For example:

ruby testfilename.rb thing compare

This executes only the the last test. The verbose output is:

T: Thing
S: Thing: assign foo
T: Thing
T: Thing: compare foo in two instances
P: Thing: compare foo in two instances
  1 passed,   0 failed,   1 skipped,   0 errors in Thing

Note that the "assign foo" test was skipped, and counted as such.

TestGarden has some similarities to [2] but instead of continuations TestGarden recreates objects for each branch. This is less efficient, but more insulated form side effects.

[1] In reference to "The garden of forking paths", by J.L. Borges.

[2] http://www.evanmiller.org/functional-tests-as-a-tree-of-continuations.html