Sha256: 7280d3e143c4a48f2c3f5a0fd4cc7c661395ed98d48c2b76928abbc159629e08

Contents?: true

Size: 532 Bytes

Versions: 4

Compression:

Stored size: 532 Bytes

Contents

module Scan
  class TestResultParser
    def parse_result(output)
      # e.g. ...<testsuites tests='2' failures='1'>...
      matched = output.match(%r{\<testsuites tests='(\d+)' failures='(\d+)'/?\>})

      if matched and matched.length == 3
        tests = matched[1].to_i
        failures = matched[2].to_i

        return {
          tests: tests,
          failures: failures
        }
      else
        Helper.log.error "Couldn't parse the number of tests from the output".red
        return {}
      end
    end
  end
end

Version data entries

4 entries across 4 versions & 1 rubygems

Version Path
scan-0.5.2 lib/scan/test_result_parser.rb
scan-0.5.1 lib/scan/test_result_parser.rb
scan-0.5.0 lib/scan/test_result_parser.rb
scan-0.4.2 lib/scan/test_result_parser.rb