Class: Trainer::XCResult::Repetition

Inherits:
Object
  • Object
show all
Includes:
TestCaseAttributes
Defined in:
trainer/lib/trainer/xcresult/repetition.rb

Overview

Represents retries of a test case, including the original run e.g. a test case that ran 3 times in total will be represented by 3 Repetition instances in the ‘xcresulttool` JSON output, one for the original run and one for the 2 retries.

Instance Attribute Summary collapse

Class Method Summary collapse

Instance Method Summary collapse

Methods included from TestCaseAttributes

#failed?, included, #passed?, #skipped?

Constructor Details

#initialize(name:, duration:, result:, failure_messages: [], source_references: [], attachments: []) ⇒ Repetition

Returns a new instance of Repetition.



18
19
20
21
22
23
24
25
# File 'trainer/lib/trainer/xcresult/repetition.rb', line 18

def initialize(name:, duration:, result:, failure_messages: [], source_references: [], attachments: [])
  @name = name
  @duration = duration
  @result = result
  @failure_messages = failure_messages
  @source_references = source_references
  @attachments = attachments
end

Instance Attribute Details

#attachmentsObject (readonly)

Returns the value of attribute attachments.



16
17
18
# File 'trainer/lib/trainer/xcresult/repetition.rb', line 16

def attachments
  @attachments
end

#durationObject (readonly)

Returns the value of attribute duration.



12
13
14
# File 'trainer/lib/trainer/xcresult/repetition.rb', line 12

def duration
  @duration
end

#failure_messagesObject (readonly)

Returns the value of attribute failure_messages.



14
15
16
# File 'trainer/lib/trainer/xcresult/repetition.rb', line 14

def failure_messages
  @failure_messages
end

#nameObject (readonly)

Returns the value of attribute name.



11
12
13
# File 'trainer/lib/trainer/xcresult/repetition.rb', line 11

def name
  @name
end

#resultObject (readonly)

Returns the value of attribute result.



13
14
15
# File 'trainer/lib/trainer/xcresult/repetition.rb', line 13

def result
  @result
end

#source_referencesObject (readonly)

Returns the value of attribute source_references.



15
16
17
# File 'trainer/lib/trainer/xcresult/repetition.rb', line 15

def source_references
  @source_references
end

Class Method Details

.from_json(node:) ⇒ Object



27
28
29
30
31
32
33
34
35
36
# File 'trainer/lib/trainer/xcresult/repetition.rb', line 27

def self.from_json(node:)
  new(
    name: node['name'],
    duration: parse_duration(node['duration']),
    result: node['result'],
    failure_messages: extract_failure_messages(node),
    source_references: extract_source_references(node),
    attachments: extract_attachments(node)
  )
end