Class: TestRail::Suite

Inherits:
Object
  • Object
show all
Includes:
InitializeWithApi
Defined in:
lib/test_rail/suite.rb

Instance Method Summary collapse

Methods included from InitializeWithApi

#initialize

Instance Method Details

#add_section(args) ⇒ Object

suite.add_section( :name => ‘Section name )



26
27
28
# File 'lib/test_rail/suite.rb', line 26

def add_section( args)
  @api.add_section( :project_id => project_id, :suite_id => @id, :name =>  args[:name] )
end

#find_or_create_section(args) ⇒ Object



35
36
37
38
39
40
41
42
# File 'lib/test_rail/suite.rb', line 35

def find_or_create_section( args )
  name = args[:name] or raise "Need to provide the section name"
  section = self.find_section( args )
  if section.nil?
    section = add_section( args )
  end
  section
end

#find_section(args) ⇒ Object



30
31
32
33
# File 'lib/test_rail/suite.rb', line 30

def find_section( args )
  name = args[:name] or raise "Need to provide the section name"
  sections.select{ |s| s.name == name }.first
end

#sectionsObject

Get a list of sections for this suite



20
21
22
23
# File 'lib/test_rail/suite.rb', line 20

def sections
  sections = @api.get_sections( :project_id => @project_id, :suite_id => @id )
  sections.reject{ |s| s.parent_id != nil }
end

#updateObject

Save changes made to this object back in testrail suite.description = “New description” suite.update



15
16
17
# File 'lib/test_rail/suite.rb', line 15

def update
  @api.update_suite( :id => @id, :name => @name, :description => @description)
end