{"id":15270348,"url":"https://github.com/famished-tiger/macros4cuke","last_synced_at":"2025-04-12T06:32:09.927Z","repository":{"id":8142443,"uuid":"9561419","full_name":"famished-tiger/Macros4Cuke","owner":"famished-tiger","description":"Add macro-steps to your Cucumber scenarios","archived":false,"fork":false,"pushed_at":"2025-02-17T11:58:00.000Z","size":437,"stargazers_count":7,"open_issues_count":0,"forks_count":3,"subscribers_count":3,"default_branch":"master","last_synced_at":"2025-04-11T04:48:53.901Z","etag":null,"topics":["cucumber","cucumber-scenarios","gherkin","ruby"],"latest_commit_sha":null,"homepage":null,"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/famished-tiger.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}},"created_at":"2013-04-20T08:40:28.000Z","updated_at":"2025-02-17T11:58:03.000Z","dependencies_parsed_at":"2022-07-20T17:08:39.407Z","dependency_job_id":null,"html_url":"https://github.com/famished-tiger/Macros4Cuke","commit_stats":null,"previous_names":[],"tags_count":0,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/famished-tiger%2FMacros4Cuke","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/famished-tiger%2FMacros4Cuke/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/famished-tiger%2FMacros4Cuke/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/famished-tiger%2FMacros4Cuke/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/famished-tiger","download_url":"https://codeload.github.com/famished-tiger/Macros4Cuke/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":248529787,"owners_count":21119580,"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":["cucumber","cucumber-scenarios","gherkin","ruby"],"created_at":"2024-09-30T07:08:31.673Z","updated_at":"2025-04-12T06:32:09.889Z","avatar_url":"https://github.com/famished-tiger.png","language":"Ruby","funding_links":[],"categories":[],"sub_categories":[],"readme":"Macros4Cuke\n===========\n_Extend Cucumber with macro-steps._  \n[Homepage](https://github.com/famished-tiger/Macros4Cuke)  \n[Documentation] (https://www.relishapp.com/famished-tiger/macros4cuke/docs)\n\n[![Linux Build Status](https://travis-ci.org/famished-tiger/Macros4Cuke.png?branch=master)](https://travis-ci.org/famished-tiger/Macros4Cuke)\n[![Windows Build status](https://ci.appveyor.com/api/projects/status/amsdudnqo1jqfody?svg=true)](https://ci.appveyor.com/project/famished-tiger/macros4cuke)\n[![Code Climate](https://codeclimate.com/github/famished-tiger/Macros4Cuke.png)](https://codeclimate.com/github/famished-tiger/Macros4Cuke.png)\n[![Gem Version](https://badge.fury.io/rb/macros4cuke.png)](http://badge.fury.io/rb/macros4cuke)\n[![License](https://img.shields.io/badge/license-MIT-brightgreen.svg?style=flat)](https://github.com/famished-tiger/Macros4Cuke/blob/master/LICENSE.txt)\n\n__Macros4Cuke__ is a Cucumber extension that adds a macro facility for your Cucumber scenarios.  \n  With it, you can create any new step that replaces a sequence of sub-steps.\n  All this can be done directly in your feature files without programming step definitions.\n\n### Highlights ###\n* Works with out-of-the-box Cucumber\n* Simple installation and setup (no programming required),\n* Familiar syntax for macro-step definitions,\n* Sub-step sequence can be of arbitrary length,\n* Macro-steps may have data arguments,\n* Data values can be passed to the sub-steps,\n* Domain neutral: applicable to any kind of application that can be driven with Cucumber,\n* A group of sub-steps can be made conditional.\n\n\nSince version 0.4.00, it is also possible to [list all the encountered macro definitions](#listing-all-the-macro-definitions).\n\n## A quick example ##\nHere is a macro-step example taken from our demo files:  \n\n```cucumber\n    Given I define the step \"When I [enter my userid \u003cuserid\u003e and password \u003cpassword\u003e]\" to mean:  \n    \"\"\"  \n    Given I landed in the homepage  \n    When I click \"Sign in\"  \n    And I fill in \"Username\" with \"\u003cuserid\u003e\"  \n    And I fill in \"Password\" with \"\u003cpassword\u003e\"  \n    And I click \"Submit\"  \n    \"\"\"  \n```\n\nThe first line above specifies the syntax of the macro-step (it is the text between the square brackets).  \nNotice also how the macro-step arguments _userid_ and _password_ are enclosed between chevrons (angle brackets) \u003c...\u003e.\nFinally, the text lines between by the triple quotes \"\"\" represent the Cucumber steps to execute when\nthe macro-step is invoked(used) elsewhere in a feature file.\n\n\nThat macro-step can then be used/invoked in a scenario like this:  \n\n```cucumber\n    When I [enter my userid \"jdoe\" and password \"hello-world\"]\n```\n\nOnce it is executing, the invoked macro-step should be equivalent to:  \n\n```cucumber\n    Given I landed in the homepage  \n    When I click \"Sign in\"  \n    And I fill in \"Username\" with \"jdoe\"  \n    And I fill in \"Password\" with \"hello-world\"  \n    And I click \"Submit\"    \n```\n\nIn other words, this sequence of 5 steps can be replaced by just one.\nMacros4Cuke not only helps in getting rid of the repeated step sequences,\n it allows the feature writers to create themselves higher-level steps\n that are closer to the business logic.  \n\nSee also the working examples in the ```features/``` folder.\nNicely formatted documentation extracted from these feature files is also available on the [Relish website](https://www.relishapp.com/famished-tiger/macros4cuke/docs)\n\n## Setup ##\n### Pre-requisites ###\n\nMacros4Cuke works with:  \n- MRI Ruby 1.9.x, 2.0.x and 2.1.x.  \n- JRuby (was tested with version 1.7.3 and above),  \n- Rubinius 2.x\n\nMacros4Cuke requires Cucumber.\n\n### Installation ###\nThe macros4cuke gem installation is fairly standard.  \nIf you have a `Gemfile`, add `macros4cuke` to it. Otherwise, install the gem like this:\n\n```bash  \n$[sudo] gem install macros4cuke\n```\n\n### Configuring your Cucumber projects ####\nThe procedure to add support for macros in an existing Cucumber project\nwas simplified since version 0.5.00.\n\nThere are two possible ways to do it:  \n- By editing manually a support file; or,  \n- Let Macros4cuke configure your project.   \n\n#### Alternative 1: manually add one line in a support file  \nRequire the library in one of your ruby files under `features/support` (e.g. `env.rb`):  \n\n```ruby\n# /features/support/env.rb\n# Add the next single line\nrequire 'macros4cuke/cucumber'  \n```\n\nThat's it! Now you can start writing macros in your Cucumber project.\n\n#### Alternative 2: let macros4cuke configure your project\n\nUse the following command-line:\n```bash  \n$[sudo] macros4cuke --setup project_path\n```\n\nWhere __project_path__ is the location of your Cucumber project.  \nIn case the working directory of the shell/command prompt is\nalready the directory containing the Cucumber project, then the\ncommand-line is simply:  \n```bash  \n$[sudo] macros4cuke --setup .\n```\n\nNotice that ending dot above means \"the current directory\".\n\n\n## Getting started ##\nWorking with a macro-step is a two-stages process:  \n1. Defining a new macro-step; and,  \n2. Using that macro-step in a scenario.\n\nLet's begin by taking a closer look at the definition part.\n### Defining a macro-step ###\nTo create a macro-step, you'll need to use a __defining__ step bundled with Macros4Cuke.\nIt is a rather unusual Cucumber step in the sense that its sole purpose is to build another step!  \nThe _defining step_ follows the general pattern:\n\n```cucumber\n  Given I define the step \"When I [some phrase]\" to mean:  \n  \"\"\"  \n  # A sequence of sub-steps comes here\n  \"\"\"  \n```\n\nThe defining step has two key components:  \n1. The _quoted sentence_ ```\"When I [some phrase]\"```. That part\n specifies the syntax of your future macro-step.  \n2. The multiline text enclosed between the triple quotes (\"\"\") that immediately follows the\n the defining step. It is the place where the sub-steps are listed.  \n\nThese two components are detailed now.\n\n\n#### Specifying the syntax of a macro-step ####\nAs just mentioned earlier, the __quoted sentence__ determines the syntax of the new macro-step.\nIts syntax is defined like this:  \n- The text outside the square brackets follows a fixed pattern. In other words,\n the quoted sentence MUST always start as follows: ```\"When I [...```. Notice however,\n that the Given, Then and '*' keywords are also allowed.  \n- The text delimited by the square brackets [...], is called the __phrase__.  \n\nA few remarks about the __phrase__ part:  \n- It must be unique. In other words, it is not possible to create another\n  macro-step with the same phrase. In fact, Macros4Cuke uses the phrase internally as a mean to identify/name\n  a macro-step.  \n- It may have one or more arguments.\nBesides that, the text inside the phrase can be arbitrary (well, almost).\n\nA phrase can be without argument as in:  \n\n```cucumber\n  # A phrase without argument\n  [enter my credentials]\n```\n\nAlternatively, a phrase can have one or more arguments enclosed between chevrons \u003c...\u003e.\nFor instance, the next first phrase has two arguments, the second has three arguments:  \n\n```cucumber\n  [enter my \u003cuserid\u003e and \u003cpassword\u003e]\n  [travel from \u003corigin\u003e to \u003cdestination\u003e via \u003cwaypoint\u003e]\n```\n\nEach argument (variable) is enclosed between \u003c...\u003e chevrons. In our last example,\nthe argument names are: _origin_ and _destination_. Notice that _origin_ and _destination_ are\n variable names that will take a value (if any) when the step is invoked _(more on this later)_.\n\n\n#### Specifying the sub-steps of a macro-step ####\nThe sub-steps are placed in a Gherkin multiline text, that is, a text that is enclosed between\n triple quotes (\"\"\"). In the next example,  \n\n```cucumber\n  Given I define the step \"When I [enter my credentials]\" to mean:  \n  \"\"\"  \n  Given I landed in the homepage   \n  And I fill in \"Username\" with \"tweedledum\"  \n  And I fill in \"Password\" with \"tweedledee\"  \n  And I click \"Sign in\"  \n  \"\"\"  \n```  \n\nthe text between triple quotes enumerates the sub-steps associated with the macro-step.  \n A pleasing aspect is the familiar syntax the sub-steps have: they closely look to genuine steps of a scenario.  \nSub-steps can also have macro arguments.\n For instance, the previous step sequence could have two arguments called _userid_ and _password_:  \n\n```cucumber  \n  \"\"\"  \n  Given I landed in the homepage   \n  And I fill in \"Username\" with \"\u003cuserid\u003e\"  \n  And I fill in \"Password\" with \"\u003cpassword\u003e\"  \n  And I click \"Sign in\"  \n  \"\"\"  \n```\n\n### Using (invoking) a macro-step ###\nA macro-step can only be invoked after its definition has been read by Cucumber.  \nThe syntax rules for using a given macro-step in a scenario are pretty straightforward:  \n- Follow closely the syntax of the _quoted sentence_ in the macro definition.  \n- Replace every \\\u003cargument\\\u003e in the _phrase_ by its actual value between quotes.  \n\n#### Example 1: ####\nConsider the following macro-step definition:  \n\n```cucumber\n  Given I define the step \"When I [log in as \u003cuserid\u003e]\" to mean:\n  \"\"\"\n  # Sub-steps come here...\n  \"\"\"\n```\n\nIts quoted sentence is ```\"When I [log in as \u003cuserid\u003e]\"```, therefore\n the macro-step can be invoked in a scenario like this:  \n\n```cucumber\n  Given I do this ...\n  When I [log in as \"jdoe\"]\n  And I do that...\n```  \n\n#### Example 2: ####\nHere is another -partial- macro-step definition:  \n\n```cucumber\n  Given I define the step \"When I [travel from \u003corigin\u003e to \u003cdestination\u003e via \u003cstop\u003e]\" to mean:\n  \"\"\"\n  # Sub-steps come here...\n  \"\"\"\n```\n\nThis macro-step can occur in a scenario as:  \n\n```cucumber\n  When I [travel from \"San Francisco\" to \"New-York\" via \"Las Vegas\"]\n```\n\nThe actual values for the arguments _origin_, _destination_ and _stop_ are\nrespectively San Francisco, New-York and Las Vegas.\n\n\n### Passing argument data via a table  ###\nPassing more than three arguments in the phrase becomes problematic from a readability viewpoint.\n One ends up with lengthy and clumsy steps.  \nTherefore __Macros4Cuke__ has an alternative way to pass data values via a Gherkin table.  \nTo enable this mechanism for a given macro, ensure that in its definition the quoted sentence ends with\na terminating colon (:) character.\n\nThe next example is based on one of the demo feature files:  \n\n```cucumber\n  # Next step has a colon ':'  after the ']': data can be passed with a table\n  Given I define the step \"When I [enter my address as follows]:\" to mean:\n  \"\"\"\n  When I fill in firstname with \"\u003cfirstname\u003e\"  \n  And I fill in lastname with  \"\u003clastname\u003e\"  \n  And I fill in street with \"\u003cstreet_address\u003e\"  \n  And I fill in postcode with \"\u003cpostcode\u003e\"  \n  And I fill in locality with \"\u003ccity\u003e\"  \n  And I fill in country with \"\u003ccountry\u003e\"  \n  \"\"\"\n```\n\nThis step can be used like this:  \n\n```cucumber\n  When I [enter my address as follows]:\"  \n  |lastname|Doe|  \n  |firstname|John|  \n  |street_address| Main Street, 22|  \n  |city| Old White Castle|  \n  |postcode|JK345|  \n```\n\nHere are few observations worth noticing:   \n- The data table has two columns.  \n- Each row is of the form: |argument name| actual value|. For instance, the argument _street_address_ takes\nthe value \"Main Street, 22\".  \n- Data rows don't have to follow strictly the order of the arguments in the sub-step sequence.\n\n## Macro-step arguments ##\n\n### Argument names ###\nIn line with most computer languages, Macros4Cuke accepts argument names containing alphanumeric characters and\nunderscores.  \nIn fact, the only characters that are not allowed in argument names are the following punctuation or delimiting\nsigns:  \n__\\!\"'\\#$%\\\u0026\\*\\+\\-/,\\.\\:\\;\\=\\?\\(\\)\\\u003c\\\u003e\\[\\]\\{\\}\\\\\\^\\`\\|\\~__\n\n\n### Assigning a value to an argument ###\nAn argument appearing in the phrase MUST always be bound to a value at the step invokation.\nTaking again a previous example of a -partial- macro-step definition:  \n\n```cucumber\n  Given I define the step \"When I [travel from \u003corigin\u003e to \u003cdestination\u003e via \u003cstop\u003e]\" to mean:\n  \"\"\"\n  # Sub-steps come here...\n  \"\"\"\n```\n\nThe following step invokation is invalid:  \n\n```cucumber\n  When I [travel from \"San Francisco\" to via \"Las Vegas\"]\n```\n\nThe issue is: the destination value is missing, Macros4Cuke won't be able to find a step with that syntax.  \nThe next invokation is syntactically correct for Macros4Cuke:  \n\n```cucumber\n  When I [travel from \"San Francisco\" to \"\" via \"Las Vegas\"]\n```\n\nThe _destination_ argument gets an empty text as actual value.\n\nFor any argument that can receive a value through a data table, three situations can occur:  \n1. A row for that argument together with a text value are specified at invokation. The argument is bound to that text value.  \n2. A row for that argument and an empty text value are specified at invokation. The argument is bound to an empty text.  \n3. There is no row for that argument. The argument is unbound (nil) but is rendered as an empty text.  \n\n## Sub-steps with multiline text argument ##\n- __Question__: is it possible to define a macro-step with a sub-step that itself\n uses a multiline text argument (also called a docstring)?  \n- __Answer__: Yes but there is a catch.\n\nConsider the following attempt of a macro-step definition:  \n\n```cucumber\n  Given I define the step \"* I [make a long journey]\" to mean:\n  \"\"\"\n    When I visit the cities:\n    \"\"\"\n    Amsterdam\n    Brussels\n    Copenhagen\n    \"\"\"\n  \"\"\"\n```\n\nThis will result in an error. The issue is caused by the nesting of triple quotes:\nCucumber simply doesn't allow this. In fact, the error is reported by [Gherkin](https://github.com/cucumber/gherkin),\na component used by Cucumber.  \nAs Gherkin has other [issues](https://github.com/cucumber/gherkin/issues/124) with docstrings, we\nneed a workaround today until the fixes are applied.  \nThe workaround is the following:  \n- There exists in Macros4Cuke a predefined sub-step argument called __\\\u003cquotes\\\u003e__ and its value\nis set to a triple quote sequence \"\"\".  \n- Use it everywhere you want to place nested triple quotes.\n\nThus to make the previous example work, one must change it like follows:  \n\n```cucumber\n  Given I define the step \"* I [make a long journey]\" to mean:\n  \"\"\"\n    When I visit the cities:\n    \u003cquotes\u003e\n    Amsterdam\n    Brussels\n    Copenhagen\n    \u003cquotes\u003e\n  \"\"\"\n```\n\n\n## Conditional sections in substeps. ##\nTo make the macros more flexible, it is possible to define conditional sections in the substep sequence.  \nThe general pattern for the conditional section is:\n\n```cucumber\n  \u003c?foobar\u003e\n  substep1\n  substep2\n  \u003c/foobar\u003e\n```\n\nThis works like this:\n```\u003c?foobar\u003e``` marks the begin of a conditional section. The end of that section is marked by ```\u003c/foobar\u003e```.  \nAnything that is in this section will be executed provided the argument ```foobar``` has a value bound to it.\nStated otherwise, when ```foobar``` has no value at invokation, then ```substep1``` and ```substep2``` will be skipped.  \nConditional sections are useful for steps that are optional or for which an empty value '' isn't equal to no value.\nThis is the case in user interface testing: skipping a field or entering a field and leaving it empty may\nlead to very different system behaviour (e.g. setting the focus in a field can trigger UI-events).  \n\nConsider the following example:  \n\n```cucumber\n  Given I define the step \"* I [fill in the form with]:\" to mean:\n  \"\"\"\n  When I fill in \"first_name\" with \"\u003cfirstname\u003e\"\n  And I fill in \"last_name\" with \"\u003clastname\u003e\"\n  And I fill in \"street_address\" with \"\u003cstreet_address\u003e\"\n  And I fill in \"zip\" with \"\u003cpostcode\u003e\"\n  And I fill in \"city\" with \"\u003ccity\u003e\"\n  # Let's assume that e-mail is optional\n  \u003c?email\u003e\n  And I fill in \"email\" with \"\u003cemail\u003e\"\n  \u003c/email\u003e\n  And I click \"Save\"\n  \"\"\"\n```\n\nWhen invoked like this:\n\n```cucumber\n  When I [fill in the form with]:\n  |firstname     |Alice|\n  |lastname      | Inn |\n  |street_address| 11, No Street|\n  |city| Nowhere-City|\n  |country|Wonderland|\n```\n\nthe following substep sequence is executed:\n```cucumber\n  When I fill in \"first_name\" with \"Alice\"\n  And I fill in \"last_name\" with \"Inn\"\n  And I fill in \"street_address\" with \"11, No Street\"\n  And I fill in \"zip\" with \"\"\n  And I fill in \"city\" with \"Nowhere-City\"\n  And I click \"Save\"\n```\n\nA few remarks concerning the executed sequence:  \n1. Every macro argument (say, firstname) that takes a value (say, \"Alice\"), is replaced\n that by that value in the substeps.  \n2. Every macro argument (say, zip) that doesn't have a corresponding row in the data table,\n is replaced by an empty text (look at the substep for the zip code entry).  \n3. The substep with the email entry doesn't appear at all. This can be explained by the conditional\nsection \u003c?email\u003e...\u003c/email\u003e that prevents the enclosed substep(s) to be generated in absence of a value for\nthe email macro argument.\n\n\nA typical use case for conditional sections is to prevent the execution of one or more steps in\nabsence of a given data item. This simulates, for instance, the behaviour of a user that skips\none or more widgets in a page/screen. From a user interface testing viewpoint, entering an empty\ntext in an entry field may be noticeably different than skipping that same entry field.\nThink of specific UI-events that can trigger some special system response.\n\n\n## More documentation ##\nMore samples and documentation can be found in the `features` folder. It contains\nmany feature files and README.md -in Markdown format-.\nMost of the material has been rewritten and adapted so that it can be consulted at the Relish website.\nRelish -The living document- website is great to turn your feature files into an attractive documentation.\n\n[Macros4Cuke @ Relish] (https://www.relishapp.com/famished-tiger/macros4cuke/docs)\n\n\n## Listing all the macro definitions ##\nWhen one begins to write macros spread over a large collection of feature files\n it becomes interesting to have an overview, a list of all macro ever defined.  \nTherefore _Macros4Cuke_ comes with a pre-defined step that generates such a list of macro definitions.  \nThis specialized step has the following syntax:\n\n```cucumber\n  When I want to list all the macros in the file \"all_macros.feature\"\n```\n\nWhere `all_macros.feature` is a feature file that will be generated when Cucumber\nterminates. The resulting feature file lists all the macros (one per scenario) in\nthe familiar Gherkin syntax. The file is placed in the current directory (i.e. the directory where\nCucumber was launched).\n\n\n\n## A word on Step Argument Transforms##\nCucumber provides a handy facility that helps to convert implicitly the values of step arguments.\nA first description of this lesser-known functionality is available at\n[Step Argument Transforms] (https://github.com/cucumber/cucumber/wiki/Step-Argument-Transforms).  \nDoes Macros4Cuke provide such a facility for its own macro-step arguments?  \nThe answer is no: if macro-steps had their own kind of transformations, then these would have interfere with the ones defined directly in Cucumber.\nIn fact, Cucumber will happily apply transformations on any step, including the macro definition steps and the\nsteps invoking macros. Stated otherwise, all the rules pertaining to the Step Argument Transforms work as usual. Or almost.\nThere is one very specific case where Cucumber behaves slightly differently: the transforms aren't applied when a sub-step is executed.\nInternally, Macros4Cuke calls the `Cucumber::RbSupport::RbWorld::#steps` method that allows to run a Gherkin snippet (the substeps),\nand it appears that this method does not trigger the transforms. In practice, this doesn't prevent the use of transforms together\nwith Macros4Cuke. In the vast majority of cases both will work fine as expected.\n\n\n## FAQ ##\n__Q__: Can I define a macro in one scenario and invoke it in another scenario in the same feature file?  \n__A__: Yes. Once a macro is defined in a feature file it can be invoked in any scenario that follows the definition.  \nIn fact, the macro can be invoked in any scenario from any feature file, provided the invokation takes place _after_ the\nmacro definition.  \n\n__Q__: So, a macro can be shared between multiple files.  \n__A__: Indeed. This is similar to genuine step definitions which are global (accessible to every feature files).\nFor macro-steps, again, they can be used anywhere after their definition.  \n\n__Q__: How should I pass arguments: via the phrase or a data table?  \n__A__: Both data passing mechanisms can be used at the same time. Favour data value passing\nvia the phrase when the number of macro arguments is small (say, \u003c= 2).   \n\n__Q__: Can I define a macro-step in a `Background` section?  \n__A__: No. Here is why: every step from the Background section is executed in each scenario (outline).\nIf a macro were defined in the Background, then the macro definition will occur multiple times, which is\n flagged as an error by Macros4Cuke.  \n\n__Q__: Can I define a macro-step in a `Scenario Outline`?  \n__A__: No, if the scenario outline has multiple rows then an error will occur. Bear in mind,\nthat steps in a scenario outline are repeating n times, n being the number of rows in the example table.\nSince a macro can only be defined once, placing a macro definition in a scenario outline will\nmost likely cause an error.  \n\n__Q__: Can I __invoke/call__ a macro-step in a `Background` or `Scenario Outline`?  \n__A__: Yes. As a macro-step can be invoked multiple times.\n\n\n\n## Changelog\n\nMacros4Cuke's changelog is available [here](CHANGELOG.md).\n\n## More resources:\n-   [**Detailed CI status**](https://travis-ci.org/famished-tiger/Macros4Cuke)\n-   [**Suggest an improvement**](https://github.com/famished-tiger/Macros4Cuke/issues)\n-   [**Report a bug**](https://github.com/famished-tiger/Macros4Cuke/issues)\n\n\n### With great power comes great responsibility. ###\n_Stan Lee_  \n\nOur experience is that macro-steps change deeply the way one designs and writes feature files.  \nMacro-steps are most useful in UI-testing (e.g. with tools like Capybara) because they help to close\n the gap between the user's intent and the low-level user interface actions.   \nIn addition __Macros4Cuke__ allows advanced users to craft their own steps without having to program step definitions.\nThis last argument becomes important in the context of user acceptance testing, a domain where the assumption that\n every tester is also Rubyist is -alas!- far from the truth.\n\n\nMacros with Cucumber is a hot topic, so it is good to know what other people say about it:  \n[Support for Macros] (https://github.com/cucumber/gherkin/issues/178)  \n[Substeps - macro request for the nth time] (http://grokbase.com/t/gg/cukes/133ey063b8/cucumber-substeps-macro-request-for-the-nth-time)\n\n\nCopyright\n---------\nCopyright (c) 2014-2025, Dimitri Geshef. Macros4Cuke is released under the MIT License see [LICENSE.txt](https://github.com/famished-tiger/Macros4Cuke/blob/master/LICENSE.txt) for details.\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Ffamished-tiger%2Fmacros4cuke","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Ffamished-tiger%2Fmacros4cuke","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Ffamished-tiger%2Fmacros4cuke/lists"}