Module: Itriagetestrail::Sections

Included in:
TestRailInterface
Defined in:
lib/itriagetestrail/testrail_objects/sections.rb

Instance Method Summary collapse

Instance Method Details

#add_testrail_section(section_title) ⇒ Object



24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
# File 'lib/itriagetestrail/testrail_objects/sections.rb', line 24

def add_testrail_section(section_title)
  body = if @suite_name
           {
             name: section_title,
             suite_id: testrail_suite_id(@suite_name)
           }
         else
           {
             name: section_title
           }
         end

  res = @client.send_post("add_section/#{@project_id}", body)

  testrail_section = res['id']

  # re-establish sections
  testrail_sections

  testrail_section
end

#testrail_section_id(section_title) ⇒ Object



16
17
18
19
20
21
22
# File 'lib/itriagetestrail/testrail_objects/sections.rb', line 16

def testrail_section_id(section_title)
  res = -1
  @sections.each do |section|
    res = section['id'] if section['name'] == section_title
  end
  res
end

#testrail_sectionsObject

TestRail Sections



6
7
8
9
10
11
12
13
14
# File 'lib/itriagetestrail/testrail_objects/sections.rb', line 6

def testrail_sections
  case @suite_mode
  when 2, 3
    @suite_id = testrail_suite_id(@suite_name)
    @sections = @client.send_get("get_sections/#{@project_id}&suite_id=#{@suite_id}")
  else
    @sections = @client.send_get("get_sections/#{@project_id}")
  end
end