class Swiftrail::Testrail::Reporter

Attributes

strict[R]
test_rail_base_url[R]
test_rail_password[R]
test_rail_username[R]
test_report_patterns[R]
tests_patterns[R]

Public Class Methods

new(test_report_patterns, tests_patterns, test_rail_username, test_rail_password, test_rail_base_url, strict) click to toggle source
# File lib/swiftrail/testrail/reporter.rb, line 9
def initialize(test_report_patterns, tests_patterns, test_rail_username, test_rail_password, test_rail_base_url, strict)
  @test_report_patterns = test_report_patterns
  @tests_patterns = tests_patterns
  @test_rail_username = test_rail_username
  @test_rail_password = test_rail_password
  @test_rail_base_url = test_rail_base_url
  @strict = strict
end

Public Instance Methods

report_results(run_id, dry_run) click to toggle source
# File lib/swiftrail/testrail/reporter.rb, line 18
def report_results(run_id, dry_run)
  unless dry_run
    test_rail_client(run_id).publish_results(purge(assembler(swift_test_parser.parse, junit_parser.parse).assemble, run_id))
  else
    STDOUT::puts("RUN_ID = #{run_id}")
    STDOUT::puts(purge(assembler(swift_test_parser.parse, junit_parser.parse).assemble, run_id).map(&:to_json))
  end
end

Private Instance Methods

assembler(swift_tests, junit_test_suites) click to toggle source
# File lib/swiftrail/testrail/reporter.rb, line 31
def assembler(swift_tests, junit_test_suites)
  Assembler.new(swift_tests, junit_test_suites)
end
junit_parser() click to toggle source
# File lib/swiftrail/testrail/reporter.rb, line 45
def junit_parser
  Swiftrail::Junit::Parser.new(test_report_patterns)
end
purge(test_cases, run_id) click to toggle source
# File lib/swiftrail/testrail/reporter.rb, line 35
def purge(test_cases, run_id)
  test_cases.select do |test_case|
    !strict || test_rail_test_cases(run_id).include?(test_case.case_id)
  end
end
swift_test_parser() click to toggle source
# File lib/swiftrail/testrail/reporter.rb, line 41
def swift_test_parser
  Swiftrail::Swift::Parser.new(tests_patterns)
end
test_rail_client(run_id) click to toggle source
# File lib/swiftrail/testrail/reporter.rb, line 53
def test_rail_client(run_id)
  Api::Client.new(test_rail_base_url, test_rail_username, test_rail_password, run_id)
end
test_rail_test_cases(run_id) click to toggle source
# File lib/swiftrail/testrail/reporter.rb, line 49
def test_rail_test_cases(run_id)
  @test_cases ||= test_rail_client(run_id).all_tests.map(&:case_id).map(&:to_s)
end