Class: TestCenter::Helper::XcodeJunit::TestCase

Inherits:
Object
  • Object
show all
Defined in:
lib/fastlane/plugin/test_center/helper/junit_helper.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(xml_element) ⇒ TestCase

Returns a new instance of TestCase.



75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
# File 'lib/fastlane/plugin/test_center/helper/junit_helper.rb', line 75

def initialize(xml_element)
  @root = xml_element
  name = xml_element.attribute('name').value
  failure_element = xml_element.elements['failure']
  if failure_element
    @message = failure_element.attribute('message')&.value || ''
    @location = failure_element.text || ''
  end
  full_testsuite = xml_element.parent.attribute('name').value
  testsuite = full_testsuite.testsuite
  is_swift = full_testsuite.testsuite_swift?

  testable_filename = xml_element.parent.parent.attribute('name').value
  testable = File.basename(testable_filename, '.xctest')
  @identifier = "#{testable}/#{testsuite}/#{name}"
  @skipped_test = Xcodeproj::XCScheme::TestAction::TestableReference::SkippedTest.new
  @skipped_test.identifier = "#{testsuite}/#{name}#{'()' if is_swift}"
  @passed = xml_element.get_elements('failure').size.zero?
end

Instance Attribute Details

#identifierObject (readonly)

Returns the value of attribute identifier.



70
71
72
# File 'lib/fastlane/plugin/test_center/helper/junit_helper.rb', line 70

def identifier
  @identifier
end

#locationObject (readonly)

Returns the value of attribute location.



73
74
75
# File 'lib/fastlane/plugin/test_center/helper/junit_helper.rb', line 73

def location
  @location
end

#messageObject (readonly)

Returns the value of attribute message.



72
73
74
# File 'lib/fastlane/plugin/test_center/helper/junit_helper.rb', line 72

def message
  @message
end

#skipped_testObject (readonly)

Returns the value of attribute skipped_test.



71
72
73
# File 'lib/fastlane/plugin/test_center/helper/junit_helper.rb', line 71

def skipped_test
  @skipped_test
end

Instance Method Details

#passed?Boolean

Returns:

  • (Boolean)


95
96
97
# File 'lib/fastlane/plugin/test_center/helper/junit_helper.rb', line 95

def passed?
  @passed
end