class Tagrail
Public Class Methods
new(output)
click to toggle source
Calls superclass method
# File lib/tagrail.rb, line 11 def initialize(output) @options = {} super(output) end
Public Instance Methods
close(null_notification)
click to toggle source
Calls superclass method
# File lib/tagrail.rb, line 46 def close(null_notification) puts "TestRail Exporter [INFO] Closing..." super end
dump_summary(notification)
click to toggle source
Calls superclass method
# File lib/tagrail.rb, line 24 def dump_summary(notification) @options = RSpec.configuration.testrail_formatter_options @client = Testrail::Client.new(@options) @run = @client.add_run(@options[:project_id], @options[:suite_id], @run_name) notification.examples.each do |example| case_id = example.metadata[:test_id] result = { status_id: Testrail::STATUS[example.execution_result.status] } exception = example.execution_result.exception #if a test returns an exception, the exception will be included #as a result comment in testrail if !exception.nil? result.merge!({ comment: "Error: #{exception} #{exception.backtrace.join('\n')}"}) end @client.add_result_for_case(@run['id'], case_id, result) end super end
start(notification)
click to toggle source
Calls superclass method
# File lib/tagrail.rb, line 16 def start(notification) @run_name = start_timestamp puts "TestRail Exporter [INFO] Executing #{notification.count} tests. Loaded in #{notification.load_time}" super end
Private Instance Methods
start_timestamp()
click to toggle source
# File lib/tagrail.rb, line 53 def start_timestamp Time.at((Time.now.to_i.to_s[0..7] + "00").to_i).strftime('%d %b %Y %R %Z') end