Class: CircleCI::TestReport::TestSuite
- Inherits:
-
Object
- Object
- CircleCI::TestReport::TestSuite
- Defined in:
- lib/circleci/test_report/test_suite.rb
Instance Attribute Summary collapse
-
#errors ⇒ Object
Returns the value of attribute errors.
-
#failures ⇒ Object
Returns the value of attribute failures.
-
#hostname ⇒ Object
Returns the value of attribute hostname.
-
#name ⇒ Object
Returns the value of attribute name.
-
#seed ⇒ Object
Returns the value of attribute seed.
-
#skipped ⇒ Object
Returns the value of attribute skipped.
-
#test_cases ⇒ Object
Returns the value of attribute test_cases.
-
#tests ⇒ Object
Returns the value of attribute tests.
-
#time ⇒ Object
Returns the value of attribute time.
-
#timestamp ⇒ Object
Returns the value of attribute timestamp.
Instance Method Summary collapse
- #add_test_case(testcase) ⇒ Object
-
#initialize ⇒ TestSuite
constructor
A new instance of TestSuite.
- #to_xml ⇒ Object
Constructor Details
#initialize ⇒ TestSuite
Returns a new instance of TestSuite.
8 9 10 11 12 13 14 15 16 17 18 19 |
# File 'lib/circleci/test_report/test_suite.rb', line 8 def initialize @test_cases = [] @name = "" @tests = 0 @skipped = 0 @failures = 0 @errors = 0 @time = 0 @timestamp = nil @seed = 0 @hostname = "" end |
Instance Attribute Details
#errors ⇒ Object
Returns the value of attribute errors.
6 7 8 |
# File 'lib/circleci/test_report/test_suite.rb', line 6 def errors @errors end |
#failures ⇒ Object
Returns the value of attribute failures.
6 7 8 |
# File 'lib/circleci/test_report/test_suite.rb', line 6 def failures @failures end |
#hostname ⇒ Object
Returns the value of attribute hostname.
6 7 8 |
# File 'lib/circleci/test_report/test_suite.rb', line 6 def hostname @hostname end |
#name ⇒ Object
Returns the value of attribute name.
6 7 8 |
# File 'lib/circleci/test_report/test_suite.rb', line 6 def name @name end |
#seed ⇒ Object
Returns the value of attribute seed.
6 7 8 |
# File 'lib/circleci/test_report/test_suite.rb', line 6 def seed @seed end |
#skipped ⇒ Object
Returns the value of attribute skipped.
6 7 8 |
# File 'lib/circleci/test_report/test_suite.rb', line 6 def skipped @skipped end |
#test_cases ⇒ Object
Returns the value of attribute test_cases.
6 7 8 |
# File 'lib/circleci/test_report/test_suite.rb', line 6 def test_cases @test_cases end |
#tests ⇒ Object
Returns the value of attribute tests.
6 7 8 |
# File 'lib/circleci/test_report/test_suite.rb', line 6 def tests @tests end |
#time ⇒ Object
Returns the value of attribute time.
6 7 8 |
# File 'lib/circleci/test_report/test_suite.rb', line 6 def time @time end |
#timestamp ⇒ Object
Returns the value of attribute timestamp.
6 7 8 |
# File 'lib/circleci/test_report/test_suite.rb', line 6 def @timestamp end |
Instance Method Details
#add_test_case(testcase) ⇒ Object
21 22 23 |
# File 'lib/circleci/test_report/test_suite.rb', line 21 def add_test_case(testcase) @test_cases << testcase end |
#to_xml ⇒ Object
25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 |
# File 'lib/circleci/test_report/test_suite.rb', line 25 def to_xml xml_markup = Builder::XmlMarkup.new xml_markup.instruct! xml_markup.testsuite(name: name, tests: tests, skipped: skipped, failures: failures, errors: errors, time: time, timestamp: , hostname: hostname) do |testsuite| testsuite.properties { |p| p.property(name: "seed", value: seed) } test_cases.each do |test_case| testsuite.testcase(classname: test_case.classname, name: test_case.name, file: test_case.file, time: test_case.time) do |t| if test_case.failure t.failure(message: test_case.failure[:message], type: test_case.failure[:type]) do |f| f.text! test_case.failure[:text] end elsif test_case.skipped t.skipped end end end end end |