Created
January 14, 2022 16:39
-
-
Save akostadinov/ad4a2ab2852bccfd4caf1cb33b9574f2 to your computer and use it in GitHub Desktop.
Cucumber list-only filter. Will only print list of feature files that were selected for testing. Needs to be registered as a last filter.
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
require 'cucumber/core/filter' | |
# put inside features/support/ | |
class PrintOnlyCukeFilter < Cucumber::Core::Filter.new | |
def test_case(test_case) | |
announce | |
print_file_for(test_case) | |
end | |
private | |
def announce | |
puts "FILTERED FILES:" unless @announced | |
@announced = true | |
end | |
def print_file_for(test_case) | |
current_file = test_case.location.file | |
return if current_file == @last_file | |
@last_file = current_file | |
puts test_case.location.file | |
end | |
end | |
AfterConfiguration do |config| | |
config.filters << PrintOnlyCukeFilter.new | |
end |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment