Class: TestResultFailure

Inherits:
TestResult show all
Defined in:
lib/perfecto-reporting/test/result/TestResultFailure.rb

Overview

TestResultFailure

Define a failure test result.

Constant Summary collapse

@@STATUS =
'FAILED'

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(reason, error, failureReason = nil) ⇒ TestResultFailure

Create a new instance

reason - string representation of the failure reason error - exception caused to the failure failureReason - one of the failure reasons in the catalogue



17
18
19
20
21
22
23
24
25
26
27
28
29
# File 'lib/perfecto-reporting/test/result/TestResultFailure.rb', line 17

def initialize(reason, error, failureReason=nil)
  if error.is_a? Exception
    @message = reason + '. Stack Trace:' + error.backtrace.to_s
  else
    @message = reason
  end
  ## Validate that the reason + error stacktrace are not longer then 4096 charcters 
  if @message.length > 4096
    @message = @message[0,4096]
  end
  @failureReason = failureReason

end

Instance Attribute Details

#failureReasonObject

Returns the value of attribute failureReason.



8
9
10
# File 'lib/perfecto-reporting/test/result/TestResultFailure.rb', line 8

def failureReason
  @failureReason
end

#messageObject

Returns the value of attribute message.



8
9
10
# File 'lib/perfecto-reporting/test/result/TestResultFailure.rb', line 8

def message
  @message
end

Instance Method Details

#isSuccessfulObject



31
32
33
# File 'lib/perfecto-reporting/test/result/TestResultFailure.rb', line 31

def isSuccessful
  return false
end

#statusObject



35
36
37
# File 'lib/perfecto-reporting/test/result/TestResultFailure.rb', line 35

def status
  @@STATUS
end