Skip to content

Instantly share code, notes, and snippets.

@kpolitowicz
Created October 16, 2019 16:28
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 kpolitowicz/30b75e00507d186bf6cafc6c4194671d to your computer and use it in GitHub Desktop.
Save kpolitowicz/30b75e00507d186bf6cafc6c4194671d to your computer and use it in GitHub Desktop.
pbpaste | ruby -e 'failed = $stdin.read.split(/\n+/).map{|s| s[/features.*?:\d+/]}.compact ; exit if failed.empty? ; cmd = "CUCUMBER_FORMAT=pretty bundle exec cucumber -r features/ #{failed.join(" ")}" ; $stderr.puts cmd ; puts cmd' | /bin/sh
@kpolitowicz
Copy link
Author

kpolitowicz commented Oct 16, 2019

Just clipboard-copy the whole "Failing Scenarios", e.g.:

Failing Scenarios:
cucumber features/compliance_obligations/activities/change_activity_status.feature:32 # Scenario: Assigning new status in sheet mode
cucumber features/compliance_obligations/activities/update_activity_custom_field.feature:38 # Scenario: Adding text to a section custom field in sheet mode

and run the one-liner.

In every line it will match the first cuc feature with line number (e.g. features/compliance_obligations/activities/change_activity_status.feature:32) and run them together. It will also output the full cuc command to STDERR for convenience.

Edit: pbpaste works out-of-the-box on Mac OSX, here is how to make it work on Linux: https://www.ostechnix.com/how-to-use-pbcopy-and-pbpaste-commands-on-linux/

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