Skip to content

Instantly share code, notes, and snippets.

@mokagio
Created November 28, 2017 06:37
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save mokagio/e9198bcc161c304752256b171b87c2e7 to your computer and use it in GitHub Desktop.
Save mokagio/e9198bcc161c304752256b171b87c2e7 to your computer and use it in GitHub Desktop.
Script used to get the slowest tests from Xcode as part of the Code Quality Challenge
# Run your tests in Xcode, copy the result in the console in a file, the run
#
# cat your_file | ruby sort-tests.rb
report = ARGF.read
times = report.lines
.select { |l| l.match(/Test Case .* \((\d*\.\d*) seconds\)/).nil? == false }
.map do |m|
{
text: m.strip,
time: m.match(/.* \((\d*\.\d*) seconds\)/).captures.last.to_f
}
end
.sort_by { |hash| hash[:time] }
.reverse
puts times
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment