Class: CI::Syntax::Tool::Format::JUnit
- Defined in:
- lib/ci-syntax-tool/format/junit.rb
Overview
CI::Syntax::Tool::Format::Progress
Prints a dot for each
API you need if you want to add a format.
Instance Attribute Summary collapse
-
#doc ⇒ Object
readonly
Returns the value of attribute doc.
-
#root ⇒ Object
readonly
Returns the value of attribute root.
-
#testcase ⇒ Object
readonly
Equiv to file.
-
#testsuite ⇒ Object
readonly
Equiv to lang.
Attributes inherited from Base
Instance Method Summary collapse
- #file_finished(file_result) ⇒ Object
- #file_started(file_result) ⇒ Object
-
#initialize(io, args) ⇒ JUnit
constructor
A new instance of JUnit.
- #lang_started(lang_result) ⇒ Object
- #overall_finished(overall_result) ⇒ Object
Methods inherited from Base
descendant_classes, #lang_finished, #overall_started
Constructor Details
Instance Attribute Details
#doc ⇒ Object (readonly)
Returns the value of attribute doc.
11 12 13 |
# File 'lib/ci-syntax-tool/format/junit.rb', line 11 def doc @doc end |
#root ⇒ Object (readonly)
Returns the value of attribute root.
12 13 14 |
# File 'lib/ci-syntax-tool/format/junit.rb', line 12 def root @root end |
#testcase ⇒ Object (readonly)
Equiv to file
14 15 16 |
# File 'lib/ci-syntax-tool/format/junit.rb', line 14 def testcase @testcase end |
#testsuite ⇒ Object (readonly)
Equiv to lang
13 14 15 |
# File 'lib/ci-syntax-tool/format/junit.rb', line 13 def testsuite @testsuite end |
Instance Method Details
#file_finished(file_result) ⇒ Object
35 36 37 38 39 40 41 42 43 |
# File 'lib/ci-syntax-tool/format/junit.rb', line 35 def file_finished(file_result) file_result.issues.each do |issue| failure = Nokogiri::XML::Element.new('failure', doc) failure['type'] = issue.level.to_s = Nokogiri::XML::CDATA.new(doc, issue. || issue.) failure.add_child() testcase.add_child(failure) end end |
#file_started(file_result) ⇒ Object
29 30 31 32 33 |
# File 'lib/ci-syntax-tool/format/junit.rb', line 29 def file_started(file_result) @testcase = Nokogiri::XML::Element.new('testcase', doc) testcase['name'] = file_result.path.gsub('/','_').gsub('.','_') testsuite.add_child(testcase) end |
#lang_started(lang_result) ⇒ Object
23 24 25 26 27 |
# File 'lib/ci-syntax-tool/format/junit.rb', line 23 def lang_started(lang_result) @testsuite = Nokogiri::XML::Element.new('testsuite', doc) testsuite['name'] = lang_result.language_name root.add_child(testsuite) end |
#overall_finished(overall_result) ⇒ Object
45 46 47 48 |
# File 'lib/ci-syntax-tool/format/junit.rb', line 45 def overall_finished(overall_result) out.write doc.to_s out.flush end |