-
Notifications
You must be signed in to change notification settings - Fork 495
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
adding parser to extract files from cucumber profile #576
base: master
Are you sure you want to change the base?
Changes from 1 commit
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -174,6 +174,7 @@ def parse_options!(argv) | |
opts.on("--only-group INT[, INT]", Array) { |groups| options[:only_group] = groups.map(&:to_i) } | ||
|
||
opts.on("-e", "--exec [COMMAND]", "execute this code parallel and with ENV['TEST_ENV_NUMBER']") { |path| options[:execute] = path } | ||
opts.on("--cucumber_profile [PROFILE]", "execute cucumber profile") {|profile| options[:cucumber_profile] = profile} | ||
opts.on("-o", "--test-options '[OPTIONS]'", "execute test commands with those options") { |arg| options[:test_options] = arg.lstrip } | ||
opts.on("-t", "--type [TYPE]", "test(default) / rspec / cucumber / spinach") do |type| | ||
begin | ||
|
@@ -211,6 +212,7 @@ def parse_options!(argv) | |
|
||
files, remaining = extract_file_paths(argv) | ||
unless options[:execute] | ||
files = extract_files_from_cucumber_profile(options[:cucumber_profile]) if (!files.any?)&&options.key?(:cucumber_profile) | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. if files.empty? && cucumber_profile = options[:cucumber_profile]
files = extract_files_from_cucumber_profile(cucumber_profile)
end There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. ... also add here |
||
abort "Pass files or folders to run" unless files.any? | ||
options[:files] = files | ||
end | ||
|
@@ -228,6 +230,11 @@ def parse_options!(argv) | |
options | ||
end | ||
|
||
def extract_files_from_cucumber_profile(profile) | ||
return unless @runner.name.eql?('cucumber') | ||
@runner.files_from_profile(profile) | ||
end | ||
|
||
def extract_file_paths(argv) | ||
dash_index = argv.rindex("--") | ||
file_args_at = (dash_index || -1) + 1 | ||
|
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,4 +1,5 @@ | ||
require "parallel_tests/gherkin/runner" | ||
require 'cucumber' | ||
|
||
module ParallelTests | ||
module Cucumber | ||
|
@@ -28,6 +29,12 @@ def summarize_results(results) | |
output.join("\n\n") | ||
end | ||
|
||
|
||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. remove extra line |
||
def files_from_profile(name) | ||
profile = ::Cucumber::Cli::ProfileLoader.new.args_from(name) | ||
profile.delete_if{|x| !x.match(self.test_suffix)} | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. -> |
||
end | ||
|
||
def command_with_seed(cmd, seed) | ||
clean = cmd.sub(/\s--order\s+random(:\d+)?\b/, '') | ||
"#{clean} --order random:#{seed}" | ||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
use
-
in options ->cucumber-profile