perfecto-reporting 2.0.5 → 3.0.0

Sign up to get free protection for your applications and to get access to all the features.
@@ -95,12 +95,37 @@ class PerfectoReportiumClient
95
95
 
96
96
  if !testResult.isSuccessful
97
97
  params['failureDescription'] = testResult.message
98
+ params['failureReason'] = testResult.failureReason
98
99
  end
99
100
 
100
101
  executeScript($END_TEST_COMMAND, params)
101
102
  return true
102
103
  end
103
104
 
105
+ def testStop(testResult, context)
106
+
107
+ params = {
108
+ :success => testResult.isSuccessful
109
+ }
110
+
111
+ if !testResult.isSuccessful
112
+ params['failureDescription'] = testResult.message
113
+ params['failureReason'] = testResult.failureReason
114
+ end
115
+
116
+ unless context.testExecutionTags.nil?
117
+ params['tags'] = context.testExecutionTags
118
+ end
119
+
120
+ custom_json = context.customFields.map { |key, value| key + '=' + value }
121
+ # the format that script wants is: '[ "test=sample","tester=new_tester"]'
122
+ params['customFields'] = custom_json
123
+
124
+ executeScript($END_TEST_COMMAND, params)
125
+ return true
126
+ end
127
+
128
+
104
129
  # log a new assertion
105
130
  #
106
131
  # message - a message to be attached to the assertion
@@ -23,4 +23,14 @@ class TestResultFactory
23
23
  return TestResultFailure.new(reason, error)
24
24
  end
25
25
 
26
- end
26
+ # Creates a failed test execution result
27
+ #
28
+ # reason - string representation of the reason for the test failure
29
+ # error - the exception caused the failure
30
+ # failureReason - string that represents one of the catalogued failure reasons
31
+ #
32
+ # return - instance denoting a failed test execution
33
+ def self.createFailure reason, error, failureReason
34
+ return TestResultFailure.new(reason, error, failureReason)
35
+ end
36
+ end
@@ -5,7 +5,7 @@ require_relative 'TestResult'
5
5
  # Define a failure test result.
6
6
  class TestResultFailure < TestResult
7
7
 
8
- attr_accessor :message
8
+ attr_accessor :message, :failureReason
9
9
 
10
10
  @@STATUS = 'FAILED'
11
11
 
@@ -13,7 +13,8 @@ class TestResultFailure < TestResult
13
13
  #
14
14
  # reason - string representation of the failure reason
15
15
  # error - exception caused to the failure
16
- def initialize(reason, error)
16
+ # failureReason - one of the failure reasons in the catalogue
17
+ def initialize(reason, error, failureReason=nil)
17
18
  if error.is_a? Exception
18
19
  @message = reason + '. Stack Trace:' + error.backtrace.to_s
19
20
  else
@@ -23,8 +24,10 @@ class TestResultFailure < TestResult
23
24
  if @message.length > 4096
24
25
  @message = @message[0,4096]
25
26
  end
26
- end
27
+ @failureReason = failureReason
27
28
 
29
+ end
30
+
28
31
  def isSuccessful
29
32
  return false
30
33
  end
@@ -33,4 +36,4 @@ class TestResultFailure < TestResult
33
36
  @@STATUS
34
37
  end
35
38
 
36
- end
39
+ end
@@ -2,6 +2,6 @@
2
2
 
3
3
  module Reporting
4
4
  module Perfecto
5
- VERSION = "2.0.5"
5
+ VERSION = "3.0.0"
6
6
  end
7
7
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: perfecto-reporting
3
3
  version: !ruby/object:Gem::Version
4
- version: 2.0.5
4
+ version: 3.0.0
5
5
  prerelease:
6
6
  platform: ruby
7
7
  authors: