Sha256: 1b847ff1c3c2dadf81bc81c29511762019a9d163fed801c36dc9495744910b3b

Contents?: true

Size: 607 Bytes

Versions: 4

Compression:

Stored size: 607 Bytes

Contents

require 'benchmark'

if ENV['BENCHMARK_TESTS']
  class Test::Unit::TestSuite
    @@run_count = 0
  
    def run(result, &progress_block)
      @@run_count += 1
      begin
        yield(STARTED, name)
        @tests.each do |test|
          TestBenchmarker::TestBenchmark.new(self.name, test.name, Benchmark.measure { test.run(result, &progress_block) })
        end
        yield(FINISHED, name)
      ensure
        @@run_count -= 1
        # print the results as we're exiting the very last test run...
        TestBenchmarker::TestBenchmarks.print_results if @@run_count == 0
      end
    end
  end
end

Version data entries

4 entries across 4 versions & 1 rubygems

Version Path
myronmarston-test_benchmarker-0.9.1 lib/test_benchmarker/test_suite.rb
myronmarston-test_benchmarker-0.9.2 lib/test_benchmarker/test_suite.rb
myronmarston-test_benchmarker-1.0.0 lib/test_benchmarker/test_suite.rb
myronmarston-test_benchmarker-1.0.1 lib/test_benchmarker/test_suite.rb