Class: TestrailRspecFormatter::Formatter

Inherits:
RSpec::Core::Formatters::BaseTextFormatter
  • Object
show all
Defined in:
lib/testrail_rspec_formatter/formatter.rb

Constant Summary collapse

PASSED =
1
BLOCKED =
2
UNTESTED =
3
RETEST =
4
FAILED =
5

Instance Method Summary collapse

Instance Method Details

#dump_failuresObject



50
51
52
# File 'lib/testrail_rspec_formatter/formatter.rb', line 50

def dump_failures(*)
  # Nothing
end

#dump_pendingObject



54
55
56
# File 'lib/testrail_rspec_formatter/formatter.rb', line 54

def dump_pending(*)
  # Nothing
end

#dump_summary(notification) ⇒ Object



19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
# File 'lib/testrail_rspec_formatter/formatter.rb', line 19

def dump_summary(notification)
  disabled = testrail_config_value(:disabled, "TESTRAIL_FORMATTER_DISABLED", false)
  if disabled == "1" || disabled == true
    testrail_log "skipped because it was disabled"
    return
  end

  testrail_log "starting..."

  examples = notification.examples
  results = []
  examples.each do |example|
     = example.[:testrail]
    next unless 

    result = {
      case_id: ,
      status_id: testrail_status(example),
    }
    results << result
  end

  if results.empty?
    testrail_log "no test cases found (no spec had a testrail tag)"
  else
    post_testrail_results(results)
  end
ensure
  testrail_log "finished"
end