Class: OnlyofficeTestrailWrapper::TestrailCase
- Inherits:
-
TestrailApiObject
- Object
- TestrailApiObject
- OnlyofficeTestrailWrapper::TestrailCase
- Defined in:
- lib/onlyoffice_testrail_wrapper/testrail_case.rb
Overview
Class for description of test case
Instance Attribute Summary collapse
-
#custom_steps ⇒ String
Steps of test case.
-
#estimate ⇒ String
Estimated test time.
-
#id ⇒ Integer
Id of test case.
-
#priority_id ⇒ Integer
Priority id of test case.
-
#title ⇒ String
Title of test case.
-
#type_id ⇒ Integer
Type id of test case.
Instance Method Summary collapse
- #add_result(run_id, result, comment = '', custom_fields = {}, version = '') ⇒ Object
- #delete ⇒ Object
- #get_results(run_id) ⇒ Object
-
#initialize(title = nil, type_id = 3, priority_id = 4, custom_steps = nil, id = nil) ⇒ TestCaseTestrail
constructor
Default constructor.
- #update(title = @title, type_id = @type_id, priority_id = @priority_id, custom_steps = @custom_steps) ⇒ Object
Methods inherited from TestrailApiObject
#init_from_hash, #name_id_pairs
Constructor Details
#initialize(title = nil, type_id = 3, priority_id = 4, custom_steps = nil, id = nil) ⇒ TestCaseTestrail
Default constructor
27 28 29 30 31 32 33 34 |
# File 'lib/onlyoffice_testrail_wrapper/testrail_case.rb', line 27 def initialize(title = nil, type_id = 3, priority_id = 4, custom_steps = nil, id = nil) super() @id = id @title = title @type_id = type_id @priority_id = priority_id @custom_steps = custom_steps end |
Instance Attribute Details
#custom_steps ⇒ String
Returns Steps of test case.
16 17 18 |
# File 'lib/onlyoffice_testrail_wrapper/testrail_case.rb', line 16 def custom_steps @custom_steps end |
#estimate ⇒ String
Returns Estimated test time.
18 19 20 |
# File 'lib/onlyoffice_testrail_wrapper/testrail_case.rb', line 18 def estimate @estimate end |
#id ⇒ Integer
Returns Id of test case.
8 9 10 |
# File 'lib/onlyoffice_testrail_wrapper/testrail_case.rb', line 8 def id @id end |
#priority_id ⇒ Integer
Returns priority id of test case.
14 15 16 |
# File 'lib/onlyoffice_testrail_wrapper/testrail_case.rb', line 14 def priority_id @priority_id end |
#title ⇒ String
Returns title of test case.
10 11 12 |
# File 'lib/onlyoffice_testrail_wrapper/testrail_case.rb', line 10 def title @title end |
#type_id ⇒ Integer
Returns type id of test case.
12 13 14 |
# File 'lib/onlyoffice_testrail_wrapper/testrail_case.rb', line 12 def type_id @type_id end |
Instance Method Details
#add_result(run_id, result, comment = '', custom_fields = {}, version = '') ⇒ Object
58 59 60 61 62 63 64 65 |
# File 'lib/onlyoffice_testrail_wrapper/testrail_case.rb', line 58 def add_result(run_id, result, comment = '', custom_fields = {}, version = '') response = TestrailResult.new.init_from_hash(Testrail2.http_post("index.php?/api/v2/add_result_for_case/#{run_id}/#{@id}", { status_id: TestrailResult::RESULT_STATUSES[result], comment: comment, version: version }.merge(custom_fields))) OnlyofficeLoggerHelper.log "Set test case result: #{result}. URL: #{Testrail2.get_testrail_address}index.php?/tests/view/#{response.test_id}", output_colors[result] response end |
#delete ⇒ Object
46 47 48 49 50 |
# File 'lib/onlyoffice_testrail_wrapper/testrail_case.rb', line 46 def delete @section.cases_names.delete @title OnlyofficeLoggerHelper.log "Deleted test case: #{@title}" Testrail2.http_post "index.php?/api/v2/delete_case/#{@id}", {} end |
#get_results(run_id) ⇒ Object
52 53 54 55 56 |
# File 'lib/onlyoffice_testrail_wrapper/testrail_case.rb', line 52 def get_results(run_id) case_results = Testrail2.http_get "index.php?/api/v2/get_results_for_case/#{run_id}/#{@id}" case_results.each_with_index { |test_case, index| case_results[index] = TestrailResult.new.init_from_hash(test_case) } case_results end |
#update(title = @title, type_id = @type_id, priority_id = @priority_id, custom_steps = @custom_steps) ⇒ Object
36 37 38 39 40 41 42 43 44 |
# File 'lib/onlyoffice_testrail_wrapper/testrail_case.rb', line 36 def update(title = @title, type_id = @type_id, priority_id = @priority_id, custom_steps = @custom_steps) @section.cases_names.delete @title @section.cases_names[StringHelper.warnstrip!(title.to_s)] = @id TestrailCase.new.init_from_hash(Testrail2.http_post("index.php?/api/v2/update_case/#{@id}", title: title, type_id: type_id, priority_id: priority_id, custom_steps: custom_steps)) end |