class Test::Unit::TestSuite
meaningful TestSuite instance.
has a suite method as simply providing a way to get a
have trouble keeping them straight. Think of something that
something that has a static suite method; I know because I
Note: It is easy to confuse a TestSuite instance with
A collection of tests which can be #run.
def <<(test)
def <<(test) @tests << test self end
def ==(other)
def ==(other) return false unless(other.kind_of?(self.class)) return false unless(@name == other.name) @tests == other.tests end
def delete(test)
def delete(test) @tests.delete(test) end
def delete_tests(tests)
def delete_tests(tests) @tests -= tests end
def empty?
def empty? size.zero? end
def initialize(name="Unnamed TestSuite", test_case=nil)
def initialize(name="Unnamed TestSuite", test_case=nil) @name = name @tests = [] @test_case = test_case @priority = 0 @start_time = nil @elapsed_time = nil end
def parallel_safe?
def parallel_safe? return true if @test_case.nil? @test_case.parallel_safe? end
def passed?
def passed? @tests.all?(&:passed?) end
def run(result, run_context: nil, &progress_block)
Runs the tests and/or suites contained in this
def run(result, run_context: nil, &progress_block) if run_context runner_class = run_context.runner_class else runner_class = TestSuiteRunner end runner_class.new(self).run(result, run_context: run_context) do |event, *args| case event when STARTED @start_time = Time.now when FINISHED @elapsed_time = Time.now - @start_time end yield(event, *args) end end
def size
i.e. if the suite contains other suites, it counts the
Returns the rolled up number of tests in this suite;
def size total_size = 0 @tests.each { |test| total_size += test.size } total_size end
def to_s
Overridden to return the name given the suite at
def to_s @name end