class TestRail::TestCaseResult

Attributes

assign_to[RW]
comment[RW]
exception_message[RW]
previous_comment[RW]
test_case_id[RW]
title[RW]

Public Class Methods

new(test_case_id, title) click to toggle source
# File lib/test_rail_integration/generator/test_case_result.rb, line 22
def initialize(test_case_id, title)
  self.test_case_id = test_case_id
  self.title = title
  self.previous_comment = TestRail::Connection.get_last_failed_comment(test_case_id) unless Connection.get_indexes_of_fails(test_case_id).empty?
end

Public Instance Methods

to_test_rail_api() click to toggle source

Send status to TestRail

{status_id: 1, comment: “Test passed”}

# File lib/test_rail_integration/generator/test_case_result.rb, line 33
def to_test_rail_api
  comment_message = "#{self.comment[:comment]} \"#{self.title}\""
  comment_message += "\n Exception : #{self.exception_message}" unless self.exception_message.nil?
  comment_message += "\n #{self.previous_comment}" if self.comment[:status] == COMMENT[:fail][:status] || self.comment[:status] == COMMENT[:unchanged_pass][:status]
  if self.comment[:status] == COMMENT_STATUS
    {comment: comment_message}
  else
    {status_id: self.comment[:status], comment: comment_message}
  end
end