Created
October 20, 2016 19:02
-
-
Save enkessler/4574f008e850eedaad32fa233a565de9 to your computer and use it in GitHub Desktop.
Example code for running certain Cucumber tests
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 'cql' | |
# Model your suite | |
path_to_test_suite_directory = File.dirname(__FILE__) | |
suite_model = CQL::Repository.new(path_to_test_suite_directory) | |
# Gather the first scenario of every feature | |
results = suite_model.query do | |
select :model | |
from scenarios | |
with { |scenario| scenario.get_ancestor(:feature).tests.first.equal?(scenario) } | |
transform { |scenario| "#{scenario.get_ancestor(:feature_file).path}:#{scenario.source_line}" } | |
as test_location | |
end | |
# Run each one | |
results.each do |result| | |
output = `cucumber #{result['test_location']}` | |
puts output | |
end |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment