class RSpec::Core::Formatters::Dtpformatter

Public Instance Methods

dump_summary(duration, example_count, failure_count, pending_count) click to toggle source
Calls superclass method
# File lib/rspec/core/formatters/dtp_formatter.rb, line 29
def dump_summary duration, example_count, failure_count, pending_count
  super
  output << "------Summary------\n"
  output << "Tests: #{example_count}...Failures: #{failure_count}...Total_time:#{'%.6f' % duration}...Timestamp: #{@start.iso8601}\n"
  output << "------Details-------\n"
  examples.each do |example|
    output << "------------------\n"
    send :"dump_summary_example_#{example.execution_result[:status]}", example
  end
end
dump_summary_example_failed(example) click to toggle source
# File lib/rspec/core/formatters/dtp_formatter.rb, line 48
def dump_summary_example_failed example
  exception = example.execution_result[:exception]
  backtrace = format_backtrace exception.backtrace, example
  report(example.full_description, "-1")
  output << "exception:\n\t#{exception.message}\nbacktrace:\n\t#{backtrace.join("\n")}\n\n"
end
dump_summary_example_passed(example) click to toggle source
# File lib/rspec/core/formatters/dtp_formatter.rb, line 40
def dump_summary_example_passed example
  report(example.full_description, '%.6f' % example.execution_result[:run_time])
end
dump_summary_example_pending(example) click to toggle source
# File lib/rspec/core/formatters/dtp_formatter.rb, line 44
def dump_summary_example_pending example
  report(example.full_description, "0")
end
example_classname(example) click to toggle source
# File lib/rspec/core/formatters/dtp_formatter.rb, line 55
def example_classname example
  example.file_path.sub(%r{\.[^/]*\Z}, "").gsub("/", ".").gsub(%r{\A\.+|\.+\Z}, "")
end
report(key, value) click to toggle source
# File lib/rspec/core/formatters/dtp_formatter.rb, line 5
def report(key, value)
  if output == STDOUT
    output << "usercase: #{key}......time: #{value}\n"
  else
    output << "usercase: #{key}......time: #{value}\n"
    
    dtp_path = ENV["DTPDIR"].split(";")[0]

    report_exe = "#{dtp_path}\\bin\\report.exe"

    flag = FileTest::exist?(report_exe)
    if flag == true
      system("#{report_exe} --perf --table db_case_run --key \"#{key}\" --value \'#{value}\'")
    else
      output << "can't find report.exe to record performence result\n" 
    end
  end
end
start(example_count) click to toggle source
Calls superclass method
# File lib/rspec/core/formatters/dtp_formatter.rb, line 24
def start example_count
  @start = Time.now
  super
end