class JunitModel::Parser
Parse a file path into a Junit::TestGroup
Public Class Methods
read_path(path)
click to toggle source
# File lib/junit_model/parser.rb, line 8 def self.read_path(path) Parser.new.read_path(path) end
read_string(string)
click to toggle source
# File lib/junit_model/parser.rb, line 12 def self.read_string(string) Parser.new.read_string(string) end
Public Instance Methods
read_path(path)
click to toggle source
# File lib/junit_model/parser.rb, line 16 def read_path(path) test_file = File.read(path) read_string(test_file) end
read_string(string)
click to toggle source
# File lib/junit_model/parser.rb, line 21 def read_string(string) test_output_hash = XmlSimple.xml_in string test_group = build_test_group(test_output_hash) test_group end
Private Instance Methods
build_test_cases(test_cases_array)
click to toggle source
# File lib/junit_model/parser.rb, line 45 def build_test_cases(test_cases_array) test_cases_array.map { |test_hash| JunitModel::TestCase.new(test_hash) } end
build_test_group(test_output_hash)
click to toggle source
# File lib/junit_model/parser.rb, line 29 def build_test_group(test_output_hash) test_output_hash['test_suites'] = test_output_hash['testsuite'] test_output_hash.delete('testsuite') group = JunitModel::TestGroup.new(test_output_hash) group.test_suites = build_test_suites(group.test_suites) group end
build_test_suites(test_suties_array)
click to toggle source
# File lib/junit_model/parser.rb, line 37 def build_test_suites(test_suties_array) test_suties_array.map do |suite_hash| suite = JunitModel::TestSuite.new(suite_hash) suite.testcase = build_test_cases(suite.testcase) suite end end