Module: TestRail::Client::Sections

Included in:
API
Defined in:
lib/testrail_api/client/sections.rb

Overview

Methods for the Sections API

Use the following API methods to request details about sections and to create or modify sections. Sections are used to group and organize test cases in test suites.

Instance Method Summary collapse

Instance Method Details

#add_section(project_id, data = {}) ⇒ Object

Creates a new section.

:project_id The ID of the project



37
38
39
# File 'lib/testrail_api/client/sections.rb', line 37

def add_section(project_id, data = {})
  post("add_section/#{project_id}", body: data.to_json)
end

#delete_section(section_id) ⇒ Object

Updates an existing section (partial updates are supported, i.e. you can submit and update specific fields only). Please note: Deleting a section cannot be undone and also deletes all related test cases as well as active tests & results, i.e. tests & results that weren’t closed (archived) yet.

:section_id The ID of the section



57
58
59
# File 'lib/testrail_api/client/sections.rb', line 57

def delete_section(section_id)
  post("delete_section/#{section_id}")
end

#section(section_id) ⇒ Object

Returns an existing section.

:section_id The ID of the section



14
15
16
# File 'lib/testrail_api/client/sections.rb', line 14

def section(section_id)
  get("get_section/#{section_id}")
end

#section_by_name(project_id, suite_id, section_name) ⇒ Object



28
29
30
# File 'lib/testrail_api/client/sections.rb', line 28

def section_by_name(project_id, suite_id, section_name)
  sections(project_id, suite_id).find { |section| section['name'] == section_name }
end

#sections(project_id, suite_id) ⇒ Object

Returns a list of sections for a project and test suite.

:project_id The ID of the project :suite_id The ID of the test suite (optional if the project is operating in single suite mode)



24
25
26
# File 'lib/testrail_api/client/sections.rb', line 24

def sections(project_id, suite_id)
  get("get_sections/#{project_id}&suite_id=#{suite_id}")
end

#update_section(section_id, data = {}) ⇒ Object

Updates an existing section (partial updates are supported, i.e. you can submit and update specific fields only).

:section_id The ID of the section



46
47
48
# File 'lib/testrail_api/client/sections.rb', line 46

def update_section(section_id, data = {})
  post("update_section/#{section_id}", body: data.to_json)
end