Skip to content

Instantly share code, notes, and snippets.

@enkessler
Created October 20, 2016 19:02
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save enkessler/4574f008e850eedaad32fa233a565de9 to your computer and use it in GitHub Desktop.
Save enkessler/4574f008e850eedaad32fa233a565de9 to your computer and use it in GitHub Desktop.
Example code for running certain Cucumber tests
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