Module: Omnitest::Skeptic::TestStatuses

Included in:
Scenario
Defined in:
lib/omnitest/skeptic/test_statuses.rb

Instance Method Summary collapse

Instance Method Details

#failed?Boolean

Returns:

  • (Boolean)


4
5
6
# File 'lib/omnitest/skeptic/test_statuses.rb', line 4

def failed?
  evidence.last_attempted_action != evidence.last_completed_action
end

#sample?Boolean

Returns:

  • (Boolean)


12
13
14
# File 'lib/omnitest/skeptic/test_statuses.rb', line 12

def sample?
  !source_file.nil?
end

#skipped?Boolean

Returns:

  • (Boolean)


8
9
10
# File 'lib/omnitest/skeptic/test_statuses.rb', line 8

def skipped?
  result.nil?
end

#statusObject



16
17
18
19
# File 'lib/omnitest/skeptic/test_statuses.rb', line 16

def status
  status = last_attempted_action
  failed? ? "#{status}_failed" : status
end

#status_colorObject



45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
# File 'lib/omnitest/skeptic/test_statuses.rb', line 45

def status_color
  case status_description
  when '<Not Found>' then :white
  when 'Cloned' then :magenta
  when 'Bootstrapped' then :magenta
  when 'Sample Found' then :cyan
  when 'Executed' then :blue
  when /Verified/
    if status_description =~ /Fully/
      :green
    else
      :yellow
    end
  else :red
  end
end

#status_descriptionObject



21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
# File 'lib/omnitest/skeptic/test_statuses.rb', line 21

def status_description
  case status
  when 'clone' then 'Cloned'
  when 'clone_failed' then 'Clone Failed'
  when 'detect' then 'Sample Found'
  when 'detect_failed', nil then '<Not Found>'
  when 'bootstrap' then 'Bootstrapped'
  when 'bootstrap_failed' then 'Bootstrap Failed'
  when 'detect' then 'Detected'
  when 'exec' then 'Executed'
  when 'exec_failed' then 'Execution Failed'
  when 'verify', 'verify_failed'
    validator_count = validators.count
    validation_count = validations.values.select { |v| v.status == :passed }.count
    if validator_count == validation_count
      "Fully Verified (#{validation_count} of #{validator_count})"
    else
      "Partially Verified (#{validation_count} of #{validator_count})"
    end
  # when 'verify_failed' then 'Verification Failed'
  else "<Unknown (#{status})>"
  end
end