Created
October 5, 2010 01:52
-
-
Save ahawkins/610833 to your computer and use it in GitHub Desktop.
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 test suite with this formatter to print out all undefined steps | |
# Good for finding old and unused steps after a lot of refactoring ! | |
require 'cucumber' | |
require 'cucumber/formatter/usage' | |
class UnusedSteps < Cucumber::Formatter::Usage | |
def print_summary(features) | |
add_unused_stepdefs | |
aggregate_info | |
if @options[:dry_run] | |
keys = @stepdef_to_match.keys.sort {|a,b| a.regexp_source <=> b.regexp_source} | |
else | |
keys = @stepdef_to_match.keys.sort {|a,b| a.mean_duration <=> b.mean_duration}.reverse | |
end | |
keys.each do |stepdef_key| | |
if !@stepdef_to_match[stepdef_key].any? | |
print_step_definition(stepdef_key) | |
end | |
end | |
@io.puts | |
end | |
end |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment