class TestRail::Section
Public Instance Methods
add_section( args )
click to toggle source
suite.add_section( :name => 'Section name )
# File lib/test_rail/section.rb, line 47 def add_section( args ) @api.add_section( :project_id => project_id, :parent_id => @id, :suite_id => @suite_id, :name => args[:name] ) end
find_or_create_section( args )
click to toggle source
# File lib/test_rail/section.rb, line 56 def find_or_create_section( args ) name = args[:name] or raise "Need to provide the sub-section name (:name => 'subsection01')" section = self.find_section( args ) if section.nil? section = add_section( args ) end section end
find_or_create_test_case( args )
click to toggle source
# File lib/test_rail/section.rb, line 37 def find_or_create_test_case( args ) title = args[:title] or raise "Need to provide the title of a test case" test_case = self.find_test_case( args ) if test_case.nil? test_case = new_test_case( args ) end test_case end
find_section( args )
click to toggle source
# File lib/test_rail/section.rb, line 51 def find_section( args ) name = args[:name] or raise "Need to provide the sub-section name (:name => 'subsection01')" sub_sections.select{ |s| s.name == name }.first end
find_test_case( args )
click to toggle source
# File lib/test_rail/section.rb, line 32 def find_test_case( args ) title = args[:title] or raise "Need to provide the title of a test case" test_cases.select{ |c| c.title == title }.first end
new_test_case(args)
click to toggle source
# File lib/test_rail/section.rb, line 28 def new_test_case(args) @api.add_case(args.merge({:section_id => @id })) end
sub_sections()
click to toggle source
Get a list of sub-sections
# File lib/test_rail/section.rb, line 18 def sub_sections sections = @api.get_sections( :project_id => @project_id, :suite_id => @suite_id ) sections.reject{ |s| s.parent_id != @id } end
test_cases()
click to toggle source
Get a list of test-cases
# File lib/test_rail/section.rb, line 24 def test_cases @api.get_cases( :project_id => @project_id, :suite_id => @suite_id, :section_id => @id ) end
update()
click to toggle source
# File lib/test_rail/section.rb, line 13 def update @api.update_section( :section_id => @id, :name => name, :project_id => @project_id, :suite_id => @suite_id, :parent_id => @id) end