Class: OnlyofficeTestrailWrapper::TestrailTest
- Inherits:
-
TestrailApiObject
- Object
- TestrailApiObject
- OnlyofficeTestrailWrapper::TestrailTest
- Defined in:
- lib/onlyoffice_testrail_wrapper/testrail_test.rb
Overview
Class for working with single testrail case
Instance Attribute Summary collapse
-
#assignedto_id ⇒ Integer
Assigned to id.
-
#case_id ⇒ Integer
Case id.
-
#id ⇒ Integer
Test id.
-
#run_id ⇒ Integer
Test run id.
-
#status_id ⇒ Integer
Status id.
-
#title ⇒ String
Test title.
Instance Method Summary collapse
-
#add_result(status, comment = '', version = '') ⇒ TestrailResult
Add result to current Test.
-
#get_results ⇒ Array<TestrailResult>
Get all results of single test.
-
#initialize(id = nil, run_id = nil, case_id = nil, title = '') ⇒ TestrailTest
constructor
A new instance of TestrailTest.
Methods inherited from TestrailApiObject
#init_from_hash, #name_id_pairs
Constructor Details
#initialize(id = nil, run_id = nil, case_id = nil, title = '') ⇒ TestrailTest
Returns a new instance of TestrailTest.
21 22 23 24 25 26 27 |
# File 'lib/onlyoffice_testrail_wrapper/testrail_test.rb', line 21 def initialize(id = nil, run_id = nil, case_id = nil, title = '') super() @id = id @title = title @case_id = case_id @run_id = run_id end |
Instance Attribute Details
#assignedto_id ⇒ Integer
Returns assigned to id.
19 20 21 |
# File 'lib/onlyoffice_testrail_wrapper/testrail_test.rb', line 19 def assignedto_id @assignedto_id end |
#case_id ⇒ Integer
Returns case id.
15 16 17 |
# File 'lib/onlyoffice_testrail_wrapper/testrail_test.rb', line 15 def case_id @case_id end |
#id ⇒ Integer
Returns test id.
9 10 11 |
# File 'lib/onlyoffice_testrail_wrapper/testrail_test.rb', line 9 def id @id end |
#run_id ⇒ Integer
Returns test run id.
11 12 13 |
# File 'lib/onlyoffice_testrail_wrapper/testrail_test.rb', line 11 def run_id @run_id end |
#status_id ⇒ Integer
Returns status id.
13 14 15 |
# File 'lib/onlyoffice_testrail_wrapper/testrail_test.rb', line 13 def status_id @status_id end |
#title ⇒ String
Returns test title.
17 18 19 |
# File 'lib/onlyoffice_testrail_wrapper/testrail_test.rb', line 17 def title @title end |
Instance Method Details
#add_result(status, comment = '', version = '') ⇒ TestrailResult
Add result to current Test
42 43 44 45 46 47 48 49 50 |
# File 'lib/onlyoffice_testrail_wrapper/testrail_test.rb', line 42 def add_result(status, comment = '', version = '') status = TestrailResult::RESULT_STATUSES[status] if status.is_a?(Symbol) result = TestrailResult.new.init_from_hash(Testrail2.http_post("index.php?/api/v2/add_result/#{@id}", status_id: status, comment: comment, version: version)) OnlyofficeLoggerHelper.log "Set test result: #{status}" result end |
#get_results ⇒ Array<TestrailResult>
Get all results of single test
31 32 33 34 35 |
# File 'lib/onlyoffice_testrail_wrapper/testrail_test.rb', line 31 def get_results @results.nil? ? @results = Testrail2.http_get("index.php?/api/v2/get_results/#{@id}") : (return @results) @results.each_with_index { |result, index| @results[index] = TestrailResult.new.init_from_hash(result) } @results end |