class TestSuiteModel

The model has the following structure in the repo:

module/                           : ModelItem class
module/$NAME                      : ModelItem class instance
module/$NAME/data                 : Property (str)
module/$NAME/path                 : Property (str)
bug/                              : ModelItem class
bug/$ID                           : ModelItem class instance
bug/$ID/test                      : ProxyItemList
bug/$ID/description               : Property (str)
bug/$ID/open                      : Property (bool)
test_suite/                       : ModelItem class
test_suite/$ID                    : ModelItem class instance
test_suite/description            : Property (str)
test_suite/$ID/test               : ModelItem class
test_suite/$ID/test/$ID           : ModelItem class instance
test_suite/$ID/test/$ID/module    : ProxyItemList
test_suite/$ID/test/$ID/pass      : Property (bool)
test_suite/$ID/test/$ID/log       : Property (str)
test_suite/$ID/test/$ID/timestamp : Property (ts)

Public Class Methods

new(db) click to toggle source
Calls superclass method GitDS::Model::new
# File doc/examples/test_suite/model.rb, line 133
def initialize(db)
  super db, 'test-suite model'
end

Public Instance Methods

add_bug(ident, description) click to toggle source

Add a Bug to the database.

# File doc/examples/test_suite/model.rb, line 166
def add_bug(ident, description)
  args = { :ident => ident, :description => description }
  BugModelItem.new self, BugModelItem.create(self.root, args)
end
add_module(path, data) click to toggle source

Add a Module to the database.

# File doc/examples/test_suite/model.rb, line 140
def add_module(path, data)
  args = { :ident => 
           path.split(File::SEPARATOR).reject{ |x| x.empty? }.join('.'),
           :name => File.basename(path), :path => File.dirname(path), 
           :data => data }
  ModuleModelItem.new self, ModuleModelItem.create(self.root, args)
end
add_test_suite(ident, description) click to toggle source

Add a TestSuite to the database.

# File doc/examples/test_suite/model.rb, line 201
def add_test_suite(ident, description)
  args = { :ident => ident, :description => description }
  TestSuiteModelItem.new self, TestSuiteModelItem.create(self.root, args)
end
bug(ident) click to toggle source

Instantiate a Bug.

# File doc/examples/test_suite/model.rb, line 181
def bug(ident)
  BugModelItem.new self, BugModelItem.instance_path(self.root.path, ident)
end
bugs() click to toggle source

List the IDs of all Bug in the database.

# File doc/examples/test_suite/model.rb, line 174
def bugs
  BugModelItem.list(self.root)
end
module(ident) click to toggle source

Instantiate a Module.

# File doc/examples/test_suite/model.rb, line 158
def module(ident)
  path = ModuleModelItem.instance_path(self.root.path, ident)
  ModuleModelItem.new self, path
end
modules() click to toggle source

List all Modules in the database.

# File doc/examples/test_suite/model.rb, line 151
def modules
  ModuleModelItem.list(self.root)
end
perform_tests(&block) click to toggle source

Perform all tests in all TestSuites. This yields each Test to the supplied block.

# File doc/examples/test_suite/model.rb, line 225
def perform_tests(&block)
  model = self
  exec {
    model.test_suites.each do |ident|
      s = model.test_suite(ident)
      s.perform_tests(&block)
    end
  }
end
test_suite(ident) click to toggle source

Instantiate a TestSuite.

# File doc/examples/test_suite/model.rb, line 216
def test_suite(ident)
  path = TestSuiteModelItem.instance_path(self.root.path, ident)
  TestSuiteModelItem.new self, path
end
test_suites() click to toggle source

List all TestSuitesin the database.

# File doc/examples/test_suite/model.rb, line 209
def test_suites
  TestSuiteModelItem.list(self.root)
end
update_bugs() click to toggle source

Update the status of all Bugs.

# File doc/examples/test_suite/model.rb, line 188
def update_bugs
  model = self
  exec {
    model.bugs.each do |ident|
      b = model.bug(ident)
      b.update
    end
  }
end