Since its creation, Hiptest relies on action words to ease the maintenance of your project and ensure that a consistent business terminology is used across all the scenarios. One of the greatest strength of the action words is the fact that they can have parameters, allowing a great reusability across multiple scenarios.
Use action word parameters
For example, here is the action word "a message should be displayed" that has one parameter named "messageText":
![Hiptest action word page](/cucumber/media/blog/hiptest/hiptest-actionword-page.png)
You can call it with different values in the scenarios:
![Hiptest action word calls](/cucumber/media/blog/hiptest/hiptest-action-word-calls.png)
In this case, this action word is called three times with three different values.
Use inlined parameters
To improve the scenario readability, you can inline a parameter directly in the action word name. It is pretty easy, you just have to add "parameterName" in the action word name where you want see the parameter name. For example:
![Hiptest action word with a inline parameter](/cucumber/media/blog/hiptest/hiptest-action-word-with-inline-parameter.png)
In this case, the action word calls will be displayed like that:
![Hiptest action word calls with inlined parameter](/cucumber/media/blog/hiptest/hiptest-action-word-calls-with-inlined-parameter.png)
It greatly improves scenario readability.
Note that you can rename an action word directly from the scenario editor. Be careful, here you are editing the action word name and not the parameter value. That's why in the capture below you can see that the "Coffee machine is ready" value disappears during the renaming:
![Edit action word name from step editor](/cucumber/media/blog/hiptest/edit-action-word-name-from-step-editor.png)
Use a datatable
https://youtu.be/ZB2Z2RN-Mw0
If the scenario uses a datatable, you can use the column name as a variable. You can call an action word with this value. To do so, you should use the format =variableName to specify that you want use a value of the column and not the "variableName" string.
![Hiptest datatable](/cucumber/media/blog/hiptest/hiptest-datatable.png)
![Hiptest action word call with column name as parameter value](/cucumber/media/blog/hiptest/hiptest-action-word-call-with-column-name-as-argument.png)
![Start Hiptest for free banner](/cucumber/media/blog/hiptest/HIP_GP_Start-for-free_900x200-a.png)
Automate your scenarios
Of course, when Hiptest publisher generate tests in your favorite language, parameters are generated too. For example, in Java, you'll obtain these lines in the scenario:
actionwords.theMessageMessageTextShouldBeDisplayed(greetingMessage);actionwords.theMessageMessageTextShouldBeDisplayed("Fill beans");
actionwords.theMessageMessageTextShouldBeDisplayed("Empty grounds");
And this code to define the action word:
public void theMessageMessageTextShouldBeDisplayed(String messageText) {}
Ok, fine but what is the connection with ${variable} format?
The format ${variable} has nothing to do with action word. In fact, in some cases, it is possible to use the action/result steps in a scenario. These steps are not recommended because they don't allow reusing and automating.
If you need to use a datatable column in a step, you should use the ${variable} format. For example:
![Action result steps](/cucumber/media/blog/hiptest/action-result-step.png)
Ok, so what is the problem?
The support team noticed that some users have been miss leaded and confused by the two notations and use the ${variable} format in action word names. In this case, that seems to work because tests are correctly instantiated with the datatable value but:
- no parameters are created in the action word,
- you cannot reuse the action word with other values,
- automation is impossible.
Because of this, we decided to remove the interpretation of the ${variable} format in the action word names.
And what does it involve?
If you use action word parameters with the double quotes notations, you have nothing to do. But if you're using ${variable} format in the name of your action words, the tests will not interpret the datatable parameter anymore.
No, don't do that, my project will be broken!
Do not panic, you can fix your project easily. Just go the action words page and in the menu, select Fix action words parameters.![Hiptest fix action word parameters menu](/cucumber/media/blog/hiptest/hiptest-fix-action-word-parameters-menu.png)
This feature will analyse your project and shows you the action words that are using the wrong notation:
![Fix action word parameters modal](/cucumber/media/blog/hiptest/fix-action-word-parameters-modal.png)
Just click on "Start refactoring".
![Fix action words parameters done](/cucumber/media/blog/hiptest/fix-action-words-parameters-done.png)
That's it, you can close the modal and continue to use Hiptest!