Class: TestRail::TestResult

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

Constant Summary collapse

STATUS_SUCCESS =
1
STATUS_ERROR =
5

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(test_case:, success:, comment:) ⇒ TestResult

Returns a new instance of TestResult.



12
13
14
15
16
# File 'lib/testrail/test_result.rb', line 12

def initialize(test_case:, success:, comment:)
  @test_case = test_case
  @success = success
  @comment = comment
end

Instance Attribute Details

#commentObject (readonly)

Returns the value of attribute comment.



8
9
10
# File 'lib/testrail/test_result.rb', line 8

def comment
  @comment
end

#successObject (readonly) Also known as: success?

Returns the value of attribute success.



9
10
11
# File 'lib/testrail/test_result.rb', line 9

def success
  @success
end

Instance Method Details

#status_idObject



18
19
20
# File 'lib/testrail/test_result.rb', line 18

def status_id
  success? ? STATUS_SUCCESS : STATUS_ERROR
end

#to_hashObject



22
23
24
25
26
27
28
# File 'lib/testrail/test_result.rb', line 22

def to_hash
  {
    'case_id': @test_case.id,
    'status_id': status_id,
    'comment': comment
  }
end