Class: CI::Reporter::TestUtils::Accessor

Inherits:
Object
  • Object
show all
Defined in:
lib/ci/reporter/test_utils/accessor.rb

Defined Under Namespace

Classes: Error, Failure, Testcase

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(xml) ⇒ Accessor

Returns a new instance of Accessor.



33
34
35
# File 'lib/ci/reporter/test_utils/accessor.rb', line 33

def initialize(xml)
  @root = xml.root
end

Instance Attribute Details

#rootObject (readonly)

Returns the value of attribute root.



5
6
7
# File 'lib/ci/reporter/test_utils/accessor.rb', line 5

def root
  @root
end

Instance Method Details

#errorsObject



41
42
43
# File 'lib/ci/reporter/test_utils/accessor.rb', line 41

def errors
  root.elements.to_a("/testsuite/testcase/error").map {|e| Error.new(e) }
end

#failuresObject



37
38
39
# File 'lib/ci/reporter/test_utils/accessor.rb', line 37

def failures
  root.elements.to_a("/testsuite/testcase/failure").map {|f| Failure.new(f) }
end

#system_errObject



63
64
65
# File 'lib/ci/reporter/test_utils/accessor.rb', line 63

def system_err
  all_text_nodes_as_string("/testsuite/system-err")
end

#system_outObject



59
60
61
# File 'lib/ci/reporter/test_utils/accessor.rb', line 59

def system_out
  all_text_nodes_as_string("/testsuite/system-out")
end

#testcase(name) ⇒ Object



49
50
51
# File 'lib/ci/reporter/test_utils/accessor.rb', line 49

def testcase(name)
  testcases.select {|tc| tc.name == name }.first
end

#testcasesObject



45
46
47
# File 'lib/ci/reporter/test_utils/accessor.rb', line 45

def testcases
  root.elements.to_a("/testsuite/testcase").map {|tc| Testcase.new(tc) }
end