Class: Qaxqa::Testsuite
- Inherits:
-
Object
- Object
- Qaxqa::Testsuite
- Defined in:
- lib/qaxqa/testsuite.rb
Overview
Module class to set XML parsed attributes to a suitecase object
Instance Attribute Summary collapse
-
#details ⇒ Object
Returns the value of attribute details.
-
#subject ⇒ Object
Returns the value of attribute subject.
-
#test_name ⇒ Object
Returns the value of attribute test_name.
-
#testcases ⇒ Object
Returns the value of attribute testcases.
Class Method Summary collapse
Instance Attribute Details
#details ⇒ Object
Returns the value of attribute details.
6 7 8 |
# File 'lib/qaxqa/testsuite.rb', line 6 def details @details end |
#subject ⇒ Object
Returns the value of attribute subject.
6 7 8 |
# File 'lib/qaxqa/testsuite.rb', line 6 def subject @subject end |
#test_name ⇒ Object
Returns the value of attribute test_name.
6 7 8 |
# File 'lib/qaxqa/testsuite.rb', line 6 def test_name @test_name end |
#testcases ⇒ Object
Returns the value of attribute testcases.
6 7 8 |
# File 'lib/qaxqa/testsuite.rb', line 6 def testcases @testcases end |
Class Method Details
.parse(doc) ⇒ Object
8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 |
# File 'lib/qaxqa/testsuite.rb', line 8 def self.parse(doc) root = doc.xpath("//testsuite/testsuite") main_subject = root.first.attributes["name"].value suites = [] # Parse suites root.each do |node| unless node.attributes["name"].nil? suite = Testsuite.new suite.subject = main_subject suite.test_name = node.attributes["name"].value suite.details = node.xpath("./details").text suite.testcases = [] # Parse testcases node.children.xpath("./testcase").each do |tc| testcase = Testcase.new testcase.steps = [] testcase.subject = suite.subject testcase.test_name = tc.attributes["name"].value testcase.summary = tc.xpath("./summary").text testcase.preconditions = tc.xpath("./preconditions").text testcase.test_type = "Manual" # Parse steps tc.xpath("./steps/*").each do |step_node| step = Step.new step.step_number = step_node.xpath("./step_number").text step.actions = step_node.xpath("./actions").text step.expectedresults = step_node.xpath("./expectedresults").text testcase.steps << step end suite.testcases << testcase end suites << suite end end return suites end |