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

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

Instance Attribute Summary collapse

Class Method Summary collapse

Instance Attribute Details

#failuresObject

Returns the value of attribute failures.



7
8
9
# File 'lib/gitlab/qa/report/test_result.rb', line 7

def failures
  @failures
end

#fileObject

Returns the value of attribute file.



7
8
9
# File 'lib/gitlab/qa/report/test_result.rb', line 7

def file
  @file
end

#nameObject

Returns the value of attribute name.



7
8
9
# File 'lib/gitlab/qa/report/test_result.rb', line 7

def name
  @name
end

#skippedObject

Returns the value of attribute skipped.



7
8
9
# File 'lib/gitlab/qa/report/test_result.rb', line 7

def skipped
  @skipped
end

#testcaseObject

Returns the value of attribute testcase.



7
8
9
# File 'lib/gitlab/qa/report/test_result.rb', line 7

def testcase
  @testcase
end

Class Method Details

.from_json(test) ⇒ Object



9
10
11
12
13
14
15
16
17
# File 'lib/gitlab/qa/report/test_result.rb', line 9

def self.from_json(test)
  new.tap do |test_result|
    test_result.name = test['full_description']
    test_result.file = test['file_path']
    test_result.skipped = test['status'] == 'pending'
    test_result.failures = failures_from_json_exceptions(test)
    test_result.testcase = test['testcase']
  end
end

.from_junit(test) ⇒ Object



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

def self.from_junit(test)
  new.tap do |test_result|
    test_result.name = test['name']
    test_result.file = test['file']
    test_result.skipped = test.search('skipped').any?
    test_result.failures = failures_from_junit_exceptions(test)
  end
end