https://github.com/enkessler/cuke_slicer
A tool to slice up your Cucumber test suite into small, easy to parallelize pieces.
https://github.com/enkessler/cuke_slicer
Last synced: 3 months ago
JSON representation
A tool to slice up your Cucumber test suite into small, easy to parallelize pieces.
- Host: GitHub
- URL: https://github.com/enkessler/cuke_slicer
- Owner: enkessler
- License: mit
- Created: 2015-03-25T18:22:15.000Z (over 10 years ago)
- Default Branch: master
- Last Pushed: 2024-03-17T21:31:11.000Z (over 1 year ago)
- Last Synced: 2025-03-26T03:23:36.457Z (4 months ago)
- Language: Ruby
- Size: 141 KB
- Stars: 12
- Watchers: 12
- Forks: 9
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- Changelog: CHANGELOG.md
- Contributing: CONTRIBUTING.md
- License: LICENSE.txt
Awesome Lists containing this project
README
Basic stuff:
[](https://rubygems.org/gems/cuke_slicer)
[](https://opensource.org/licenses/mit-license.php)
[](https://rubygems.org/gems/cuke_slicer)User stuff:
[](https://github.com/enkessler/cuke_slicer/tree/master/testing/cucumber/features)
[](https://www.rubydoc.info/gems/cuke_slicer)Developer stuff:
[](https://github.com/enkessler/cuke_slicer/actions/workflows/ci.yml?query=branch%3Amaster)
[](https://coveralls.io/github/enkessler/cuke_slicer?branch=master)
[](https://codeclimate.com/github/enkessler/cuke_slicer/maintainability)---
# CukeSlicer
The cuke_slicer gem provides an easy and programmatic way to divide a Cucumber test suite into granular test
cases that can then be dealt with on an individual basis. Often this means handing them off to a distributed
testing system in order to parallelize test execution.## Installation
Add this line to your application's Gemfile:
gem 'cuke_slicer'
And then execute:
$ bundle
Or install it yourself as:
$ gem install cuke_slicer
## Usage
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 = {excluded_tags: ['@tag1','@tag2'],
included_tags: '@tag3',
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)# Arrange the sliced pieces to suit your particular needs. In this case, we will dump them
# into a file that Cucumber can consume.File.open('tests_to_run.txt', 'w') { |file| file.puts found_tests }
system('cucumber @tests_to_run.txt')
In addition to tag and path filters, a block can be used for filtering tests by inspecting the
underlying CukeModeler models that represent test cases and filtering on whatever criteria you can think up.CukeSlicer::Slicer.new.slice(test_directory, {}, :file_line) do |test_case|
test_case.is_a?(CukeModeler::Scenario) &&
test_case.get_ancestor(:feature).name =~ /first/
end## Development and Contributing
See [CONTRIBUTING.md](https://github.com/enkessler/cuke_slicer/blob/master/CONTRIBUTING.md)
## License
The gem is available as open source under the terms of the [MIT License](https://opensource.org/licenses/MIT).