class RubyUnit::TestCase

All classes derrived from the RubyUnit::TestCase will automatically be run by the test runner.

MyTest < RubyUnit::TestCase
  def simpleData
    [
      [       1,   3],
      ['string', nil],
    ],
  end

  def simpleTest param1, param2
    # run assertions
  end
end

Public Class Methods

assertions() click to toggle source

Gets the current number of assertions that have been run while testing

# File lib/RubyUnit/TestCase.rb, line 106
def assertions
  @@assertions
end
descendents() click to toggle source

Gets a list of all the descendents of the RubyUnit::TestCase class. This is important when determining the tests that have been defined.

# File lib/RubyUnit/TestCase.rb, line 97
def descendents
  ObjectSpace.each_object(Class).select do |object|
    object < self
  end
end
setup() click to toggle source

The setup helper that is run before each test case begins running tests.

def self.setup
  # create objects, set up the scenario
end
# File lib/RubyUnit/TestCase.rb, line 81
def setup
end
teardown() click to toggle source

The teardown helper that is run after each test case finishes running tests.

def self.teardown
  # destroy objects, clean up after yourself
end
# File lib/RubyUnit/TestCase.rb, line 91
def teardown
end

Public Instance Methods

markIncomplete(message = nil) click to toggle source

Mark the test as incomplete

markIncomplete 'Implementation of this test is not finished'
# File lib/RubyUnit/TestCase.rb, line 65
def markIncomplete message = nil
  raise IncompleteTest, message
end
markSkipped(message = nil) click to toggle source

Mark the test as skipped

markSkipped 'This test is being refactored'
# File lib/RubyUnit/TestCase.rb, line 56
def markSkipped message = nil
  raise SkippedTest, message
end
setup() click to toggle source

The setup helper that is run before each test in the test case.

def setup
  # create objects, set up the scenario
end
# File lib/RubyUnit/TestCase.rb, line 38
def setup
end
teardown() click to toggle source

The teardown helper that is run after each test in the test case.

def teardown
  # destroy objects, clean up after yourself
end
# File lib/RubyUnit/TestCase.rb, line 48
def teardown
end