Created
November 28, 2017 06:37
-
-
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
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# 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