Use action words

Applies to CucumberStudio Cloud, and to Enterprise ver. 3.3 - 3.5.6.0. Last updated on November 17, 2023

Definition

An action word is basically a sequence of steps that can be reused across multiple scenarios. It defines the Domain Specific Language (DSL) of the project. This ubiquitous language forms a common language shared by the team members for describing acceptance tests.

Key benefits

Defining a common language with action words and building your scenarios based on them has several key advantages:

  • It makes the scenarios understandable by all the project stakeholders (product team, devs, testers).

  • It accelerates test authoring as well as maintenance and enable refactoring.

  • It facilitates automation as the scenarios based on action words can be transformed automatically into scripts for various test automation frameworks.

Action Words page

Action Words page

Click the image to enlarge it.

An action word is defined by different data:

  • Name: the name of an action word is unique within a given project.

  • Description: field text used to add a description. See Description formatting section.

  • Tags: you can add tags to an action word. The search feature can be used to search for action words based on tags.

  • Parameters: you can add parameters to an action word and use them in the steps.

  • Definition: you can add steps to your action words.

  • Used by: list of scenarios and action words that contain the current action word.

Used by section on action word page

Click the image to enlarge it.

Note: The action word page uses the same step editor as the scenario, so it works exactly the same way for both of them.

Parameters

You can add as many parameters as you want to an action word. The name of a parameter should not contain any special character or space. A default value can be assigned to a parameter.

Action word parameters

Click the image to enlarge it.

You can call an action word with the parameter value as argument by using =parameterName format:

Call action word with parameter value

You can also include a parameter in an action/result step by using the following syntax: ${parameterName}.

Use parameter in action/result step

Calling an action word in a step

When you call an action word with parameters, a value should be assigned. If you don’t specify it, the default value is applied, but it is possible to rename it afterwards.

In the Action words page, you can add some parameters to your action word.

Example of an action word parameter

Click the image to enlarge it.

When you call this action word in a scenario, it will appear as follows:

Action word call

You can also use a datatable parameter as an action word parameter value using the syntax =columnName, you should obtain:

Action word call: assign parameter
Note: The step of an action word can be another action word. It means that you can build action word of action word and thus define several layers to your Domain Specific Language (system, application, feature, automation keyword…).

Other actions available on an action word

You can apply the following actions to an action word:

  • Inline: to replace the action word by its content (the steps) in every place where this action word is called. See inline in the refactoring section.

  • Delete: to delete the action word. Be carefull, you will not be able to restore it and all the objects (scenarios and action words) using this action word will be in error.

See Also

Create scenarios
Writing scenarios with Gherkin syntax

Highlight search results