{"id":16956974,"url":"https://github.com/jgraichen/gurke","last_synced_at":"2025-03-17T08:37:29.001Z","repository":{"id":12304394,"uuid":"14935856","full_name":"jgraichen/gurke","owner":"jgraichen","description":"Gurke is an experimental, alternative cucumber runner.","archived":false,"fork":false,"pushed_at":"2025-02-17T05:37:17.000Z","size":242,"stargazers_count":6,"open_issues_count":2,"forks_count":0,"subscribers_count":4,"default_branch":"main","last_synced_at":"2025-02-27T21:37:40.423Z","etag":null,"topics":[],"latest_commit_sha":null,"homepage":"","language":"Ruby","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/jgraichen.png","metadata":{"files":{"readme":"README.md","changelog":"CHANGELOG.md","contributing":null,"funding":null,"license":"LICENSE.txt","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null}},"created_at":"2013-12-04T21:06:03.000Z","updated_at":"2025-02-17T05:37:19.000Z","dependencies_parsed_at":"2022-07-12T15:04:38.684Z","dependency_job_id":"b11ad9cc-846d-4a7a-bf52-948b379c0a22","html_url":"https://github.com/jgraichen/gurke","commit_stats":{"total_commits":175,"total_committers":7,"mean_commits":25.0,"dds":"0.48571428571428577","last_synced_commit":"ccd2c0577f7a1d6123282e63ab1e917135755e62"},"previous_names":[],"tags_count":26,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/jgraichen%2Fgurke","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/jgraichen%2Fgurke/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/jgraichen%2Fgurke/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/jgraichen%2Fgurke/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/jgraichen","download_url":"https://codeload.github.com/jgraichen/gurke/tar.gz/refs/heads/main","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":243852499,"owners_count":20358271,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":[],"created_at":"2024-10-13T22:16:31.558Z","updated_at":"2025-03-17T08:37:28.622Z","avatar_url":"https://github.com/jgraichen.png","language":"Ruby","funding_links":[],"categories":[],"sub_categories":[],"readme":"# Gurke\n\n[![Build Status](https://github.com/jgraichen/gurke/actions/workflows/test.yml/badge.svg)](https://github.com/jgraichen/gurke/actions/workflows/test.yml)\n\n**Gurke** is an experimental, alternative cucumber runner. It ~~steals~~ borrows ideas and concepts from [turnip](https://github.com/jnicklas/turnip), [rspec](http://rspec.info) and tries to avoid [cucumber](https://github.com/cucumber/cucumber/).\n\nThat includes:\n\n* Step definitions in modules\n* Before, After and Around hooks\n* Formatters\n* Partial step inclusion (via modules)\n* Keyword-dependent steps\n* Scenario-local world\n* Running DRb background test server.\n\n## Installation\n\nOr install it yourself as:\n\n```console\ngem install gurke\n```\n\nOr add it to your `Gemfile` and install it using bundler.\n\n**Note:** Install version `2.0+`. Previous versions were something else.\n\n## Usage\n\nFirst, create your `*.features` files inside `features/`, for example, `features/user/create_account.feature`. Support files and step definitions can be added as Ruby files to `features/support`.\n\n### Configuration\n\nFor example, you can configure the environment or [hooks](#hooks):\n\n```ruby\n# features/support/gurke.rb\nrequire 'gurke/rspec'\nrequire 'tmpdir'\n\nGurke.configure do |c|\n  c.around(:scenario) do |scenario|\n    Dir.mktmpdir('gurke') do |dir|\n      @__root = Pathname.new(dir)\n      scenario.call\n    end\n  end\nend\n```\n\n### Steps\n\nSteps can be defined in Ruby modules as methods, for example in `features/support/steps`:\n\n```ruby\n# features/support/steps/file_steps.rb\nmodule FileSteps\n  step(/a file \"(.*?)\" with the following content exists/) do |path, step|\n    file = @__root.join(path)\n\n    FileUtils.mkdir_p(File.dirname(file))\n    File.write(file, step.doc_string)\n  end\nend\n\nGurke.configure{|c| c.include FileSteps }\n```\n\nYou can use an existing method as a step too:\n\n```ruby\nmodule MySteps\n  def do_something(arg)\n    # ...\n  end\n\n  step(/I do something: \"(.*?)\"/, :do_something)\n\n  # Easy call it from another step\n  step(/I do something else/) { do_something('abc') }\nend\n```\n\nYou can include some steps to only scenarios with specific tags:\n\n```ruby\nmodule MyStepsA\n  step(/I do something/) { ... }\nend\n\nGurke.configure{|c| c.include FileSteps, tags: 'tagA' }\n\nmodule MyStepsB\n  step(/I do something/) { ... }\nend\n\nGurke.configure do |c|\n  c.include FileSteps, tags: [:tagB, 'bType'] # At least one tag has to match\nend\n```\n\nTherefore, you can use different step implementations for same named steps depending on the tags of the feature and scenario.\n\n#### Keyword specific step definitions\n\nYou can also define steps for only a specific keyword. This also allows you to use the same step pattern for different keywords, e.g.\n\n```ruby\nmodule PathSteps\n  Given(/^I am on the start page$/) { visit '/' }\n  Then(/^I am on the start page$/) { assert current_path == '/' }\nend\n```\n\nTherefore, you can write your scenarios in a documentary style of facts:\n\n```feature\n  Scenario: Use the back button\n    Given I am on the start page\n    When I click on \"Go to another page\"\n    And I click the back button\n    Then I am on the start page\n```\n\n`And` and `But` steps will inherit the keyword type from the step before, e.g. the `And` step above will be of the `when` type.\n\n### Hooks\n\nEach scenario runs in its own world. All modules registered to be included will be included in this world. Before and after scenario or step hooks will also be executed within this world. All steps are run in this world.\n\nYou can define hooks similar to `rspec`:\n\n```ruby\nGurke.configure do |config|\n  config.before(:scenario) do\n    visit '/' # Example: Start each scenario on index page\n  end\n\n  config.after(:features) do\n    # Do some cleanup code etc.\n  end\nend\n```\n\nThe following hooks are available:\n\n* `:features`: Will be run before and after every feature. Use to to initially setup or teardown needed resources e.g. setup capybara.\n* `:feature`: Will be run before and after any feature.\n* `:scenario`: Same for any scenario.\n* `:step`: Can be used to e.g. screenshot browser for every step.\n\n### Use the command line runner\n\nRun all scenarios by just calling `bundle exec gurke`. By default scenarios and features tagged with `@wip` will be ignored.\n\nSpecify one or more `--tags` or `-t` arguments to filter for specific tags, negate tag filters with `~`.\n\nExamples:\n\n* `--tags a,b` - only run scenarios with tags `@a` AND `@b`\n* `-t a -t b` - only run scenarios with tags `@a` OR `@b`\n* `-t a,~b` - only run scenarios with `@a` but not `@b`\n\nYou can also specify a list of files that will be run:\n\n```console\ngurke features/my_feature.feature\n```\n\nIf you append one or more line numbers - separated by colons - only the scenarios defined around the given lines will be run:\n\n```console\ngurke features/my_feature.feature:14:34\n```\n\n### Flaky scenarios\n\nIf you have scenarios that might fail sometime, you can mark them as `@flaky`:\n\n```feature\nFeature: F\n  @flaky\n  Scenario: I am flaky\n    Given I fail the first time\n    Then I will be retried a second time\n```\n\nGurke will retry a marked scenario only once if a step failed.\n\n### Formatter\n\nYou can choose another formatter using a command line switch:\n\n```console\ngurke -f team_city\n```\n\nAvailable formatters include: `default`, `compact`, `null` and `team_city`.\n\n### DRb background server (experimental)\n\nYou can run a DRb server in the background that has a running test environment (whatever that means to you) by running `gurke --drb-server`. This will load your test environment and execute all before `:system` hooks.\n\nYou can later run your features (or specific features) by running `gurke --drb`. That will run the features in the already loaded DRb server, including all other hooks.\n\nRemember to reload e.g. your step definitions before `:features` to pick up changes:\n\n```ruby\n  config.before(:features) do\n    Dir['features/steps/**/*.rb'].each{|f| load f }\n  end\n```\n\nUse the after `:system` hook to shut down resources.\n\nRemember to restart the running background server when changing hooks, configuration or removing/redefining steps as otherwise the changes won't be picked up, steps won't change, or are ambiguous now.\n\n## TODO\n\n* Add `context`/`ctx` object to world providing current feature/scenario/step\n* Define scenario specific after hook in a step (e.g. to close opened resource)\n* Random run order (rspec)\n* Using strings with placeholders as step pattern (turnip)\n* Custom placeholders (turnip)\n* More reporters (NyanCat / JUnit / Adapter to run multiple reporters)\n* SimpleCov support (and use it in own tests)\n* Scope hooks by scenario tags\n* Fast-fail\n* Additional feature-scope and global worlds\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fjgraichen%2Fgurke","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fjgraichen%2Fgurke","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fjgraichen%2Fgurke/lists"}