Class: Trainer::XCResult::ActionTestMetadata
- Inherits:
-
ActionTestSummaryIdentifiableObject
- Object
- AbstractObject
- ActionAbstractTestSummary
- ActionTestSummaryIdentifiableObject
- Trainer::XCResult::ActionTestMetadata
- Defined in:
- trainer/lib/trainer/xcresult.rb
Overview
-
ActionTestMetadata
-
Supertype: ActionTestSummaryIdentifiableObject
-
Kind: object
-
Properties: + testStatus: String + duration: Double? + summaryRef: Reference? + performanceMetricsCount: Int + failureSummariesCount: Int + activitySummariesCount: Int
-
Instance Attribute Summary collapse
-
#activity_summaries_count ⇒ Object
Returns the value of attribute activity_summaries_count.
-
#duration ⇒ Object
Returns the value of attribute duration.
-
#failure_summaries_count ⇒ Object
Returns the value of attribute failure_summaries_count.
-
#performance_metrics_count ⇒ Object
Returns the value of attribute performance_metrics_count.
-
#test_status ⇒ Object
Returns the value of attribute test_status.
Attributes inherited from ActionTestSummaryIdentifiableObject
Attributes inherited from ActionAbstractTestSummary
Attributes inherited from AbstractObject
Instance Method Summary collapse
- #all_subtests ⇒ Object
- #find_failure(failures) ⇒ Object
-
#initialize(data, parent) ⇒ ActionTestMetadata
constructor
A new instance of ActionTestMetadata.
Methods inherited from ActionTestSummaryIdentifiableObject
Methods inherited from AbstractObject
Constructor Details
#initialize(data, parent) ⇒ ActionTestMetadata
Returns a new instance of ActionTestMetadata.
162 163 164 165 166 167 168 169 |
# File 'trainer/lib/trainer/xcresult.rb', line 162 def initialize(data, parent) self.test_status = fetch_value(data, "testStatus") self.duration = fetch_value(data, "duration").to_f self.performance_metrics_count = fetch_value(data, "performanceMetricsCount") self.failure_summaries_count = fetch_value(data, "failureSummariesCount") self.activity_summaries_count = fetch_value(data, "activitySummariesCount") super(data, parent) end |
Instance Attribute Details
#activity_summaries_count ⇒ Object
Returns the value of attribute activity_summaries_count.
161 162 163 |
# File 'trainer/lib/trainer/xcresult.rb', line 161 def activity_summaries_count @activity_summaries_count end |
#duration ⇒ Object
Returns the value of attribute duration.
158 159 160 |
# File 'trainer/lib/trainer/xcresult.rb', line 158 def duration @duration end |
#failure_summaries_count ⇒ Object
Returns the value of attribute failure_summaries_count.
160 161 162 |
# File 'trainer/lib/trainer/xcresult.rb', line 160 def failure_summaries_count @failure_summaries_count end |
#performance_metrics_count ⇒ Object
Returns the value of attribute performance_metrics_count.
159 160 161 |
# File 'trainer/lib/trainer/xcresult.rb', line 159 def performance_metrics_count @performance_metrics_count end |
#test_status ⇒ Object
Returns the value of attribute test_status.
157 158 159 |
# File 'trainer/lib/trainer/xcresult.rb', line 157 def test_status @test_status end |
Instance Method Details
#all_subtests ⇒ Object
171 172 173 |
# File 'trainer/lib/trainer/xcresult.rb', line 171 def all_subtests return [self] end |
#find_failure(failures) ⇒ Object
175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 |
# File 'trainer/lib/trainer/xcresult.rb', line 175 def find_failure(failures) sanitizer = proc { |name| name.gsub(/\W/, "_") } sanitized_identifier = sanitizer.call(self.identifier) if self.test_status == "Failure" # Tries to match failure on test case name # Example TestFailureIssueSummary: # producingTarget: "TestThisDude" # test_case_name: "TestThisDude.testFailureJosh2()" (when Swift) # or "-[TestThisDudeTests testFailureJosh2]" (when Objective-C) # Example ActionTestMetadata # identifier: "TestThisDude/testFailureJosh2()" (when Swift) # or identifier: "TestThisDude/testFailureJosh2" (when Objective-C) found_failure = failures.find do |failure| # Sanitize both test case name and identifier in a consistent fashion, then replace all non-word # chars with underscore, and compare them sanitized_test_case_name = sanitizer.call(failure.test_case_name) sanitized_identifier == sanitized_test_case_name end return found_failure else return nil end end |