Skip to content

Instantly share code, notes, and snippets.

@tourdedave
Created March 28, 2013 13:22
Show Gist options
  • Save tourdedave/5263086 to your computer and use it in GitHub Desktop.
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.
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
@tourdedave
Copy link
Author

Toss this into your features/support directory, and then run it with cucumber -d -f Report::Tags

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment