Why Hiptest will remove the ability to use ${variable} format in action word names?

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

You can call it with different values in the scenarios:

Hiptest action word calls

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

In this case, the action word calls will be displayed like that:

Hiptest action word calls with inlined parameter

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

Use a datatable

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

Hiptest action word call with column name as parameter value

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

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

This feature will analyse your project and shows you the action words that are using the wrong notation:

Fix action word parameters modal

Just click on “Start refactoring”.

Fix action words parameters done

That’s it, you can close the modal and continue to use Hiptest!

 

 

2 thoughts on “Why Hiptest will remove the ability to use ${variable} format in action word names?”

  1. Hi Séverine, I’m trying to start using this new way of not referencing the datatable variables using ${columnname} notation changing them to “columnname” but this doesn’t seem to be working. Whenever I replace them, all I see in the View Tests preview is the word columnname instead of the correct variable for that test case. Can you please instruct me on how to do this correctly? Is it just that the View Tests preview won’t work anymore with this new format? Thanks

Leave a Reply

Your email address will not be published. Required fields are marked *