Class: TestResult

Inherits:
Object
  • Object
show all
Defined in:
lib/testresult.rb

Overview

Parsed test results for reporting back

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(name, status, time, output, parsed_errors, failure_type) ⇒ TestResult

Returns a new instance of TestResult



19
20
21
22
23
24
25
26
# File 'lib/testresult.rb', line 19

def initialize(name, status, time, output, parsed_errors, failure_type)
  @name = name
  @status = status
  @time = time
  @output = output
  @parsed_errors = parsed_errors
  @failure_type = failure_type
end

Instance Attribute Details

#failure_typeObject (readonly)

Returns the value of attribute failure_type



17
18
19
# File 'lib/testresult.rb', line 17

def failure_type
  @failure_type
end

#nameObject (readonly)

Returns the value of attribute name



17
18
19
# File 'lib/testresult.rb', line 17

def name
  @name
end

Instance Method Details

#inspectObject



36
37
38
39
40
41
42
43
44
45
46
47
48
49
# File 'lib/testresult.rb', line 36

def inspect
  parsed_errors_array = []

  @parsed_errors&.each { |e| parsed_errors_array << e.inspect }

  {
    :name => @name,
    :status => @status,
    :time => @time,
    :output => @output,
    :parsed_errors => parsed_errors_array,
    :failure_type => @failure_type
  }
end

#passedObject



28
29
30
# File 'lib/testresult.rb', line 28

def passed
  @status == 'passed' || @status == 'warning'
end

#warningObject



32
33
34
# File 'lib/testresult.rb', line 32

def warning
  @status == 'warning'
end