Module: Itriagetestrail::TestPlans
- Included in:
- TestRailInterface
- Defined in:
- lib/itriagetestrail/testrail_objects/test_plans.rb
Instance Method Summary collapse
- #add_plan_entry ⇒ Object
- #add_testrail_plan ⇒ Object
- #append_configuration_ids(topic, configuration) ⇒ Object
- #config_id(name, value) ⇒ Object
- #configuration_group(name) ⇒ Object
- #configuration_ids ⇒ Object
- #configurations ⇒ Object
Instance Method Details
#add_plan_entry ⇒ Object
65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 |
# File 'lib/itriagetestrail/testrail_objects/test_plans.rb', line 65 def add_plan_entry # TODO: refactor redundant assignments of @suite_id @suite_id = testrail_suite_id(@suite_name) body = { suite_id: @suite_id, # TODO: replace hardcoded name name: 'replace this with config description', include_all: true, # TODO: replace hardcoded config config_ids: configuration_ids, runs: [ { include_all: true, config_ids: configuration_ids } ] } @plan_entry = @client.send_post("add_plan_entry/#{@plan_id}", body) # TODO: replace debugging puts @plan_entry.inspect @run_id = @plan_entry['runs'][0]['id'] # TODO: replace debugging puts @run_id.inspect end |
#add_testrail_plan ⇒ Object
49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 |
# File 'lib/itriagetestrail/testrail_objects/test_plans.rb', line 49 def add_testrail_plan body = { name: test_name, description: '', milestone_id: @milestone_id } @plan = @client.send_post("add_plan/#{@project_id}", body) # TODO: replace debugging puts @plan.inspect @plan_id = @plan['id'] # TODO: replace debugging puts @plan_id.inspect end |
#append_configuration_ids(topic, configuration) ⇒ Object
45 46 47 |
# File 'lib/itriagetestrail/testrail_objects/test_plans.rb', line 45 def append_configuration_ids(topic, configuration) @configuration_ids << config_id(topic, configuration) unless configuration.nil? end |
#config_id(name, value) ⇒ Object
13 14 15 16 17 18 19 20 21 22 |
# File 'lib/itriagetestrail/testrail_objects/test_plans.rb', line 13 def config_id(name, value) res = {} configuration = configuration_group(name) return nil if configuration.empty? configuration['configs'].each do |config| res = config['id'] if config['name'] == value end res end |
#configuration_group(name) ⇒ Object
5 6 7 8 9 10 11 |
# File 'lib/itriagetestrail/testrail_objects/test_plans.rb', line 5 def configuration_group(name) res = {} @configurations.each do |config| res = config if config['name'] == name end res end |
#configuration_ids ⇒ Object
28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 |
# File 'lib/itriagetestrail/testrail_objects/test_plans.rb', line 28 def configuration_ids @configuration_ids = [] # evaluate @testrail_comfig append_configuration_ids('Browser', @testrail_config[:config][:browser]) append_configuration_ids('Browser Version', @testrail_config[:config][:browserVersion]) append_configuration_ids('Platform', @testrail_config[:config][:platform]) append_configuration_ids('Android Version', @testrail_config[:config][:android]) append_configuration_ids('Android Device', @testrail_config[:config][:androidDevice]) append_configuration_ids('IOS Version', @testrail_config[:config][:ios]) # remove the nils @configuration_ids.compact! @configuration_ids end |
#configurations ⇒ Object
24 25 26 |
# File 'lib/itriagetestrail/testrail_objects/test_plans.rb', line 24 def configurations @configurations = @client.send_get("get_configs/#{@project_id}") end |