Skip to content

Instantly share code, notes, and snippets.

Embed
What would you like to do?
Script to test check
#!/usr/bin/env ruby
# frozen_string_literal: true
TARGET_DIR = ARGV[0]
@failing_module = []
@no_test_module = []
def fail_number(file_path)
file = IO.read(file_path)
file.scan(%r{\<div class\="counter"\>(\d*)</div\>})[1][0].to_i
end
def append_fail_if_needed(mod, fail_number)
return if fail_number.zero?
@failing_module.append(
'fail': fail_number,
'mod': mod
)
end
def check_target(target_dir)
modules = Dir["#{target_dir}/*"]
modules.each do |mod|
file_path = "#{mod}/build/reports/tests/testDebugUnitTest/index.html"
if File.exist?(file_path)
append_fail_if_needed(mod, fail_number(file_path))
else
@no_test_module.append(mod)
end
end
end
if TARGET_DIR.nil?
%w[commons libs features].each { |target| check_target(target) }
else
check_target(TARGET_DIR)
end
formatted_error = @failing_module.map { |p| "#{p[:mod]} | Error: #{p[:fail]}" }
puts "Error Modules:\n#{formatted_error.join("\n")}"
puts "\n"
puts "No Test Modules:\n#{@no_test_module.join("\n")}"
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.