# module ActiveSupport::Testing::Performance::ForClassicTestUnit

### Public Instance Methods

run(result) { |STARTED, name| ... } click to toggle source

    # File lib/active_support/testing/performance.rb, line 81
    def run(result)
      return if method_name =~ %r^default_test$/

      yield(self.class::STARTED, name)
      @_result = result

      run_warmup
      if full_profile_options && metrics = full_profile_options[:metrics]
        metrics.each do |metric_name|
          if klass = Metrics[metric_name.to_sym]
            run_profile(klass.new)
            result.add_run
          else
            puts '%20s: unsupported' % metric_name
          end
        end
      end

      yield(self.class::FINISHED, name)
    end

run_test(metric, mode) click to toggle source

    # File lib/active_support/testing/performance.rb, line 102
    def run_test(metric, mode)
      run_callbacks :setup
      setup
      metric.send(mode) { __send__ @method_name }
    rescue ::Test::Unit::AssertionFailedError => e
    add_failure(e.message, e.backtrace)
    rescue StandardError, ScriptError => e
      add_error(e)
    ensure
      begin
        teardown
        run_callbacks :teardown, :enumerator => :reverse_each
      rescue ::Test::Unit::AssertionFailedError => e
        add_failure(e.message, e.backtrace)
      rescue StandardError, ScriptError => e
        add_error(e)
      end
    end