Class: Gitlab::QA::Report::TestResult

Inherits:
Object
  • Object
show all
Defined in:
lib/gitlab/qa/report/test_result.rb

Direct Known Subclasses

JUnitTestResult, JsonTestResult

Defined Under Namespace

Classes: JUnitTestResult, JsonTestResult

Instance Attribute Summary collapse

Class Method Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(report) ⇒ TestResult

Returns a new instance of TestResult.



19
20
21
22
# File 'lib/gitlab/qa/report/test_result.rb', line 19

def initialize(report)
  self.report = report
  self.failures = failures_from_exceptions
end

Instance Attribute Details

#failuresObject

Returns the value of attribute failures.



17
18
19
# File 'lib/gitlab/qa/report/test_result.rb', line 17

def failures
  @failures
end

#reportObject

Returns the value of attribute report.



17
18
19
# File 'lib/gitlab/qa/report/test_result.rb', line 17

def report
  @report
end

Class Method Details

.from_json(report) ⇒ Object



9
10
11
# File 'lib/gitlab/qa/report/test_result.rb', line 9

def self.from_json(report)
  JsonTestResult.new(report)
end

.from_junit(report) ⇒ Object



13
14
15
# File 'lib/gitlab/qa/report/test_result.rb', line 13

def self.from_junit(report)
  JUnitTestResult.new(report)
end

Instance Method Details

#fileObject

Raises:

  • (NotImplementedError)


32
33
34
# File 'lib/gitlab/qa/report/test_result.rb', line 32

def file
  raise NotImplementedError
end

#nameObject

Raises:

  • (NotImplementedError)


28
29
30
# File 'lib/gitlab/qa/report/test_result.rb', line 28

def name
  raise NotImplementedError
end

#skippedObject

Raises:

  • (NotImplementedError)


36
37
38
# File 'lib/gitlab/qa/report/test_result.rb', line 36

def skipped
  raise NotImplementedError
end

#stageObject



24
25
26
# File 'lib/gitlab/qa/report/test_result.rb', line 24

def stage
  @stage ||= file[%r{(?:api|browser_ui)/(?:(?:\d+_)?(\w+))}, 1]
end