Class Uttk::Strategies::Suite
In: lib/uttk/strategies/Suite.rb
Parent: Collection

An ordered collection of tests which can be run.

A the Suite class has two goals:

  - group a set of Strategy in a single object which is a Strategy.
  - factor some attributes which are identical in each tests of the
    the suite.

Example

 require 'uttk'
 include Uttk

 symtbl = SymTbl.new
 symtbl[:loader] = Loaders::Yaml.new
 aSuite = Strategies::Suite.new({
           :name   => 'A set of tests',
           :symtbl => symtbl,
           :wclass => Weights::WFloat,
           :attributes => {
               :strategy => Strategies::Cmd,
               :exit  => 0
             },
             :contents => OHash[
               "I'm suppose to pass 1", { :command => "true" },
               "I'm suppose to fail 2", { :command => "false", :weight => -1 },
               "I'm suppose to pass 3", { :command => "false",
                                          :exit    => 1 }
             ]
         })
 aSuite.run(Logger.new(Dumpers::Yaml.new(STDOUT)))

 aSuite = Strategies::Suite.new
 aSuite.name = 'A set of tests'
 aSuite.symtbl = symtbl
 aSuite.wclass = Weights::WFloat
 aSuite.strategyclass = Strategies::Cmd
 aSuite.exit = 0    # a sugar when its unambiguous.
 t1 = aSuite.create
 t1.name = "I'm suppose to pass 4"
 t1.command = "true"
 aSuite.create({ :name    => "I'm suppose to fail 5",
                 :command => "false",
                 :weight  => -1 })
 io = Tempfile.new('uttk-example')
 io << << EOF
 ---
 name: I'm suppose to pass 6
 command: false
 exit: 1
 EOF
 io.rewind
 aSuite.create(io)
 aSuite.run(Logger.new(Dumpers::Yaml.new(STDOUT)))

Included Modules

Concrete Ordered

[Validate]