Created
March 28, 2013 13:22
-
-
Save tourdedave/5263086 to your computer and use it in GitHub Desktop.
A custom Cucumber Report Formatter to list all tags, how many of each there are, and sort them by that count.
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
module Report | |
class Tags | |
def initialize(step_mother, path_or_io, options) | |
@all_tags = [] | |
end | |
def tag_name(tag_name) | |
@all_tags << tag_name | |
end | |
def after_features(features) | |
tracker = Hash.new(0) | |
@all_tags.each { |tag| tracker[tag] += 1 } | |
sorted_tracker = tracker.sort_by {|tag, count| count } | |
sorted_tracker.each {|tag_count| puts "#{tag_count[1]}: #{tag_count[0]}"} | |
puts "#{@all_tags.count} Tags in total" | |
end | |
end | |
end |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Toss this into your features/support directory, and then run it with
cucumber -d -f Report::Tags