Class: Tagrail
- Inherits:
-
RSpec::Core::Formatters::BaseTextFormatter
- Object
- RSpec::Core::Formatters::BaseTextFormatter
- Tagrail
- Defined in:
- lib/tagrail.rb
Instance Method Summary collapse
- #close(null_notification) ⇒ Object
- #dump_summary(notification) ⇒ Object
-
#initialize(output) ⇒ Tagrail
constructor
A new instance of Tagrail.
- #start(notification) ⇒ Object
Constructor Details
#initialize(output) ⇒ Tagrail
Returns a new instance of Tagrail.
11 12 13 14 |
# File 'lib/tagrail.rb', line 11 def initialize(output) @options = {} super(output) end |
Instance Method Details
#close(null_notification) ⇒ Object
46 47 48 49 |
# File 'lib/tagrail.rb', line 46 def close(null_notification) puts "TestRail Exporter [INFO] Closing..." super end |
#dump_summary(notification) ⇒ Object
24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 |
# File 'lib/tagrail.rb', line 24 def dump_summary(notification) @options = RSpec.configuration. @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.[: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) ⇒ Object
16 17 18 19 20 21 22 |
# File 'lib/tagrail.rb', line 16 def start(notification) @run_name = puts "TestRail Exporter [INFO] Executing #{notification.count} tests. Loaded in #{notification.load_time}" super end |