Skip to content

adding parser to extract files from cucumber profile#576

Open
vveliev wants to merge 2 commits into
grosser:masterfrom
vveliev:master
Open

adding parser to extract files from cucumber profile#576
vveliev wants to merge 2 commits into
grosser:masterfrom
vveliev:master

Conversation

@vveliev

@vveliev vveliev commented Jul 31, 2017

Copy link
Copy Markdown

Adding ability to execute cucumber profile with parallel test, using file list provided in cucumber profile

Comment thread lib/parallel_tests/cli.rb Outdated
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}

Copy link
Copy Markdown
Owner

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

Comment thread lib/parallel_tests/cli.rb Outdated

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)

Copy link
Copy Markdown
Owner

Choose a reason for hiding this comment

The 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

Copy link
Copy Markdown
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

... also add here raise "only supported for cucumber" unless @runner.name == 'cucumber' instead of in extract_files_from_cucumber_profile

output.join("\n\n")
end


Copy link
Copy Markdown
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

remove extra line

Comment thread lib/parallel_tests/cucumber/runner.rb Outdated

def files_from_profile(name)
profile = ::Cucumber::Cli::ProfileLoader.new.args_from(name)
profile.delete_if{|x| !x.match(self.test_suffix)}

Copy link
Copy Markdown
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

-> profile.grep(test_suffix)

@grosser

grosser commented Jul 31, 2017

Copy link
Copy Markdown
Owner

that looks pretty good ... how about a test so I don't break it on the next release ? :D

@grosser

grosser commented Aug 1, 2017

Copy link
Copy Markdown
Owner

parsing --test-options seems a bit hacky ... and I'd guess it blows up on unknown options ... I liked the previous --cucumber-profile option more ... or did that not work out ?



def files_from_profile(name)
::Cucumber::Cli::ProfileLoader.new.args_from(name).grep(self.test_suffix)

Copy link
Copy Markdown
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

don't need the self.

@vveliev

vveliev commented Aug 1, 2017

Copy link
Copy Markdown
Author

--cucumber-profile, it's missing logic , as I did not passed cucumber profile option to the cucumber itself ....

parallel_cucumber -o '--profile smoke --tag @setup'
parallel_cucumber -o '--tag @setup' --cucumber-profile smoke
parallel_cucumber -o '--profile smoke --tag @setup' --cucumber-profile smoke

So I think there is potential problem when profile coming from stand alone option... not sure what's the best solution.

@grosser

grosser commented Aug 1, 2017 via email

Copy link
Copy Markdown
Owner

@vveliev

vveliev commented Aug 1, 2017

Copy link
Copy Markdown
Author

Yes it could , but then It should be more like a merge ....or raise an error if profile exist in options

@grosser

grosser commented Aug 1, 2017 via email

Copy link
Copy Markdown
Owner

@teegalasv

Copy link
Copy Markdown

@grosser Any update on this pull request. i think this feature will help me too. If you know any other way to achieve this and already exists can you please point me to it.

@grosser

grosser commented Jan 6, 2020

Copy link
Copy Markdown
Owner

idk, I'm not working on this ... you could fork and use this as a base for a new PR

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants