module OnlyofficeTestrailWrapper::TestrailProjectSuiteMethods
Methods to perform operations on Suites
Public Instance Methods
create_new_suite(name, description = '')
click to toggle source
Create new test suite in project @param [String] name of suite @param [String] description description of suite @return [TestrailSuite] created suite
# File lib/onlyoffice_testrail_wrapper/testrail_project/testrail_project_suite_methods.rb, line 62 def create_new_suite(name, description = '') new_suite = HashHelper.parse_to_class_variable(Testrail2.http_post("index.php?/api/v2/add_suite/#{@id}", name: StringHelper.warnstrip!(name), description: description), TestrailSuite) new_suite.instance_variable_set('@project', self) OnlyofficeLoggerHelper.log "Created new suite: #{new_suite.name}" @suites_names[new_suite.name] = new_suite.id new_suite end
get_suite_by_id(id)
click to toggle source
# File lib/onlyoffice_testrail_wrapper/testrail_project/testrail_project_suite_methods.rb, line 43 def get_suite_by_id(id) suite = HashHelper.parse_to_class_variable(Testrail2.http_get("index.php?/api/v2/get_suite/#{id}"), TestrailSuite) suite.instance_variable_set('@project', self) OnlyofficeLoggerHelper.log("Initialized suite: #{suite.name}") suite end
get_suite_by_name(name)
click to toggle source
Get Test Suite by it's name @param [String] name name of test suite @return [TestrailSuite, nil] test suite or nil if not found
# File lib/onlyoffice_testrail_wrapper/testrail_project/testrail_project_suite_methods.rb, line 38 def get_suite_by_name(name) get_suites if @suites_names.empty? @suites_names[StringHelper.warnstrip!(name)].nil? ? nil : get_suite_by_id(@suites_names[name]) end
get_suites()
click to toggle source
Get all test suites of project @return [Array<Hash>] array with suites data in hash
# File lib/onlyoffice_testrail_wrapper/testrail_project/testrail_project_suite_methods.rb, line 19 def get_suites suites = Testrail2.http_get("index.php?/api/v2/get_suites/#{@id}") @suites_names = HashHelper.get_hash_from_array_with_two_parameters(suites, 'name', 'id') if @suites_names.empty? suites end
init_suite_by_name(name)
click to toggle source
Init suite by it's name @param [String] name name of suit @return [TestrailSuite] suite with this name
# File lib/onlyoffice_testrail_wrapper/testrail_project/testrail_project_suite_methods.rb, line 53 def init_suite_by_name(name) found_suite = get_suite_by_name name found_suite.nil? ? create_new_suite(name) : found_suite end
suite(name_or_id)
click to toggle source
# File lib/onlyoffice_testrail_wrapper/testrail_project/testrail_project_suite_methods.rb, line 6 def suite(name_or_id) case name_or_id.class.to_s when 'Fixnum' get_suite_by_id name_or_id when 'String' init_suite_by_name name_or_id else raise 'Wrong argument. Must be name [String] or id [Integer]' end end
suites()
click to toggle source
Get all test suites of project as objects @return [Array<TestrailSuite>] array with TestRailSuite
# File lib/onlyoffice_testrail_wrapper/testrail_project/testrail_project_suite_methods.rb, line 30 def suites suites = Testrail2.http_get("index.php?/api/v2/get_suites/#{@id}") suites.map { |suite| HashHelper.parse_to_class_variable(suite, TestrailSuite) } end