class Swiftrail::Testrail::Lint
Attributes
test_rail_base_url[R]
test_rail_password[R]
test_rail_username[R]
tests_patterns[R]
Public Class Methods
new(tests_patterns, test_rail_username, test_rail_password, test_rail_base_url)
click to toggle source
# File lib/swiftrail/testrail/lint.rb, line 6 def initialize(tests_patterns, test_rail_username, test_rail_password, test_rail_base_url) @tests_patterns = tests_patterns @test_rail_username = test_rail_username @test_rail_password = test_rail_password @test_rail_base_url = test_rail_base_url end
Public Instance Methods
lint_report(run_id)
click to toggle source
# File lib/swiftrail/testrail/lint.rb, line 13 def lint_report(run_id) missing_cases = all_tests_by_case_id.keys - test_rail_client(run_id).all_tests.map(&:case_id).map(&:to_s) generate_report(missing_cases) end
Private Instance Methods
all_tests_by_case_id()
click to toggle source
# File lib/swiftrail/testrail/lint.rb, line 40 def all_tests_by_case_id @all_tests_by_case_id ||= swift_tests.each_with_object({}) do |test, hash| test.case_ids.map do |case_id| if hash.key?(case_id) hash[case_id] << test else hash[case_id] = [test] end end end end
generate_report(case_ids)
click to toggle source
# File lib/swiftrail/testrail/lint.rb, line 32 def generate_report(case_ids) { reporting_invalid_case_ids: case_ids.map do |case_id| { case_id => all_tests_by_case_id[case_id].map(&:to_json) } end } end
swift_test_parser()
click to toggle source
# File lib/swiftrail/testrail/lint.rb, line 56 def swift_test_parser Swiftrail::Swift::Parser.new(tests_patterns) end
swift_tests()
click to toggle source
# File lib/swiftrail/testrail/lint.rb, line 52 def swift_tests swift_test_parser.parse end
swift_tests_for_case_id(case_id)
click to toggle source
# File lib/swiftrail/testrail/lint.rb, line 22 def swift_tests_for_case_id(case_id) swift_tests.select do |swift_test| swift_test.case_ids.include?(case_id.to_s) end end
test_rail_client(run_id)
click to toggle source
# File lib/swiftrail/testrail/lint.rb, line 28 def test_rail_client(run_id) Swiftrail::Testrail::Api::Client.new(test_rail_base_url, test_rail_username, test_rail_password, run_id) end