Module: TestRail::Client::Suites

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

Overview

Methods for the Suites API

Use the following API methods to request details about test suites and to create or modify test suites.

Instance Method Summary collapse

Instance Method Details

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

Creates a new test suite.

:project_id The ID of the project the test suite should be added to


40
41
42
# File 'lib/testrail_api/client/suites.rb', line 40

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

#suite(suite_id) ⇒ Object

Returns an existing test suite.

:suite_id The ID of the test suite


13
14
15
# File 'lib/testrail_api/client/suites.rb', line 13

def suite(suite_id)
  get("get_suite/#{suite_id}")
end

#suite_by_name(project_id, suite_name) ⇒ Object


17
18
19
# File 'lib/testrail_api/client/suites.rb', line 17

def suite_by_name(project_id, suite_name)
  suites(project_id).find { |suite| suite['name'].casecmp(suite_name) == 0 }
end

#suites(project_id) ⇒ Object

Returns a list of test suites for a project.

:project_id The ID of the project


26
27
28
# File 'lib/testrail_api/client/suites.rb', line 26

def suites(project_id)
  get("get_suites/#{project_id}")
end

#suites_by_project_name(project_name) ⇒ Object


30
31
32
33
# File 'lib/testrail_api/client/suites.rb', line 30

def suites_by_project_name(project_name)
  project_id = project_by_name(project_name).fetch('id')
  suites(project_id)
end