def build_report
      # build cases
      builder = Nokogiri::XML::Builder.new do |xml|
        xml.testsuites {
          testsuite           = xml.testsuite {
            @cases.each do |tc|
              testcase             = xml.testcase {
                if tc.result_has_message?
                  result_type           = xml.send(tc.result)
                  result_type[:message] = tc.message if tc.message.present?
                end

                if tc.system_out.size > 0
                  xml.send('system-out') { xml.text tc.system_out.to_s }
                end

                if tc.system_err.size > 0
                  xml.send('system-err') { xml.text tc.system_err.to_s }
                end
              }

              testcase[:name]      = tc.name if tc.name.present?
              testcase[:time]      = tc.time if tc.time.present?

              testcase[:classname] = package if package.present?
              if tc.classname.present?
                if testcase[:classname].present?
                  testcase[:classname] = "#{testcase[:classname]}.#{tc.classname}"
                else
                  testcase[:classname] = tc.classname
                end
              end

            end
          }

          testsuite[:name]    = name if name.present?
          testsuite[:package] = package if package.present?
        }
      end

      builder.parent.root.to_xml
    end
def build_report
      # build cases
      builder = Nokogiri::XML::Builder.new do |xml|
        xml.testsuites {
          testsuite           = xml.testsuite {
            @cases.each do |tc|
              testcase             = xml.testcase {
                if tc.result_has_message?
                  result_type           = xml.send(tc.result)
                  result_type[:message] = tc.message if tc.message.present?
                end

                if tc.system_out.size > 0
                  xml.send('system-out') { xml.text tc.system_out.to_s }
                end

                if tc.system_err.size > 0
                  xml.send('system-err') { xml.text tc.system_err.to_s }
                end
              }

              testcase[:name]      = tc.name if tc.name.present?
              testcase[:time]      = tc.time if tc.time.present?

              testcase[:classname] = package if package.present?
              if tc.classname.present?
                if testcase[:classname].present?
                  testcase[:classname] = "#{testcase[:classname]}.#{tc.classname}"
                else
                  testcase[:classname] = tc.classname
                end
              end

            end
          }

          testsuite[:name]    = name if name.present?
          testsuite[:package] = package if package.present?
        }
      end

      builder.parent.root.to_xml
    end
In short, this is the XML string that makes the report.

 @return [String] XML report