enkessler / cuke_slicer Goto Github PK
View Code? Open in Web Editor NEWA tool to slice up your Cucumber test suite into small, easy to parallelize pieces.
License: MIT License
A tool to slice up your Cucumber test suite into small, easy to parallelize pieces.
License: MIT License
cuke_slicer
is great we use it for slicing up our test suite in separate feature files per scenario to reduce variance and better utilize different knapsack workers.
There are two filter options that is missing is the ability to either include or exclude tag patterns
in addition to specific tags. I reckon that the patterns would be defined as stringified ruby regexes that are then parsed by cuke_slicer
.
require 'cuke_slicer'
# Choose which part of your test suite that you want to slice up
test_directory = 'path/to/your_test_directory'
# Choose your slicing filters
filters = {
included_tag_pattern: '<ruby_regex>',
excluded_paths: 'foo',
included_paths: [/test_directory/]}
# Use the slicer to find all tests matching those filters
found_tests = CukeSlicer::Slicer.new.slice(test_directory, filters, :file_line)
Another option would be to open up the filters
and allow a block to be passed in addition to a hash, that way one has full control over the filtering.
I'm aware that this can be achieved by passing an empty filter, and using the :test_object
return type, but I think it would be great if this use-case is somehow supported by cuke_slicer.
Please add a v2.0.2
tag to commit 9283938e1777ad323fe8152bc33fdcfa05b53393
. That commit appears to be what that release was built from.
Thanks.
I'm trying to use cuke_slicer to create a list of all tests which have at least one of a set of tags and do not have any of another set of tags. Currently cuke_slicer only returns tests with all of the tags passed, not tests with any of the tags.
Feature: This is a test file
@full_suite
Scenario: Test 1
Given foo
@continuous_deployment @full_suite
Scenario: Test 2
Given bar
@continuous_deployment
Scenario: Test 3
Given foo-bar
If I want to run all tests with @full_suite
or @continuous_deployment
I would think that I'd do:
filters = {included_tags: ['@full_suite', '@continuous_deployment'] ,
included_paths: [/test_directory/]}
found_tests = CukeSlicer::Slicer.new.slice(test_directory, filters, :file_line)
however, this results in only Scenario: Test 2
being returned because it's only choosing scenarios with both tags.
What I'd suggest doing, and this is what I might put in our code until a better solution is implemented in cuke_slicer, is use the following logical flow when preparing the list:
filters
contains included_tags:
then perform a new CukeSlicer::Slicer.new.slice(test_directory, filters, :file_line)
for each tag, appending the slice to the final list while removing duplicates.filters
contains excluded_tags:
then run through the final list from step 1 and remove tests which match any of the tags in this list.Cucumber has the ability to exclude a tag using the tilde (ex: ~@wip
) (see cucumber documentation). It might be worthwhile to deprecate the included_tags
and excluded_tags
parameters and just a tags
parameter which takes positive and negative tags and knows how to handle each one. Currently cuke_slicer doesn't seem to handle negative tags at all.
It looks like version 2.0.1 has nothing in it. No idea how it happened, but here are some handy links for yanking it and publishing a new version.
http://guides.rubygems.org/command-reference/#gem-yank
http://help.rubygems.org/kb/gemcutter/removing-a-published-rubygem
http://blog.rubygems.org/2015/04/13/permadelete-on-yank.html
It seems like cuke_slicer
currently supports an older version of cuke_modeler
, since it calls Example#row_elements
in https://github.com/grange-insurance/cuke_slicer/blob/fc0f2918b2b3f7e4c862579a78729e3fc6cd840f/lib/cuke_slicer/helpers/extraction_helpers.rb#L31
.
Does it make sense to upgrade cuke_slicer
in the following way?
cuke_modeler
#row_elements
If so, I can start a PR.
The cuke_modeler
gem has recently entered the 2.x
major version range. Can cuke_slicer
be updated to be compatible with it? Thanks.
I am following the usage section in the Readme, but am running into the following error when requiring cuke_slicer
:
cartoloupe@comp ~/repos/test_suite update-cucumber ● gem install cuke_slicer
Successfully installed cuke_slicer-2.0.0
Parsing documentation for cuke_slicer-2.0.0
Done installing documentation for cuke_slicer after 0 seconds
1 gem installed
cartoloupe@comp ~/repos/test_suite update-cucumber ● irb
irb(main):001:0> require 'cuke_slicer'
LoadError: cannot load such file -- gherkin/formatter/json_formatter
from /Users/cartoloupe/.gem/ruby/2.0.0/gems/cuke_modeler-0.0.1/lib/cuke_modeler/parsing.rb:2:in `require'
from /Users/cartoloupe/.gem/ruby/2.0.0/gems/cuke_modeler-0.0.1/lib/cuke_modeler/parsing.rb:2:in `<top (required)>'
from /Users/cartoloupe/.gem/ruby/2.0.0/gems/cuke_modeler-0.0.1/lib/cuke_modeler.rb:3:in `require'
from /Users/cartoloupe/.gem/ruby/2.0.0/gems/cuke_modeler-0.0.1/lib/cuke_modeler.rb:3:in `<top (required)>'
from /Users/cartoloupe/.gem/ruby/2.0.0/gems/cuke_slicer-2.0.0/lib/cuke_slicer.rb:1:in `require'
from /Users/cartoloupe/.gem/ruby/2.0.0/gems/cuke_slicer-2.0.0/lib/cuke_slicer.rb:1:in `<top (required)>'
from (irb):1:in `require'
from (irb):1
from /Users/cartoloupe/.rubies/ruby-2.0.0-p451/bin/irb:12:in `<main>'
I am using cucumber version 2.3.2, and ruby 2.0.0;
And then I searched for that error message, and it seems that maybe the new gherkin gem that is used in the new cucumber has changed the path for its formatters.
A declarative, efficient, and flexible JavaScript library for building user interfaces.
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google ❤️ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.