Syntax =varName and "varName" in step


#1

Hello,

I’m using BDD project and I’m a little bit confuse when I should use syntax =varName and “varName” in steps.

Can you concisely explain how/when these syntax variations apply? Thanks


#2

Hello Michele,

About variables/parameters, there are two aspects not to confuse :

  1. the data of the action word arguments (format: =variable)
  2. the renaming of an action word (format: my “parameterName” action word)

First, let’s begin with the data of the action word arguments :

Basically, when you call an action word, you can assign data to its arguments. For example, in this example:

S%C3%A9lection_123

The first step calls a action word that has no parameters.
The second one calls an action word that has one parameter named “p1” with the string value “beautiful”.
The third one calls an action word that contains an inlined parameter. That means, that this action word has a parameter and that the parameter value is displayed in the action word name. Here, I called it with the string value “beautiful”.

So, in this example, I’ve just assigned argument data as string. I will update this example, by using a data table. When you use a data table, each line (a.k.a. dataset) will allow to create a test instance.

S%C3%A9lection_124

Each column, create a variable (that is the name of the column) that can be used in the scenario with the format =columnName to differentiate it from a string.

S%C3%A9lection_125

For example, this scenario and the third dataset will give:

S%C3%A9lection_126

So, that’s it, you know what format you can use as argument value.

Now, let’s continue with the second case : the action word renaming.

You can rename an action word from the page of this action word, but it is pretty painful to navigate to the action word page from the scenario page, then next to rename the action word and finally to navigate back to the scenario. That’s why, Hiptest allows to rename an action word directly from the step editor. When you click on the action word name in the step editor, you can edit the action word name!

S%C3%A9lection_128

It is the real name of the action word. And this name contains the place where you want to put the parameter in this name. So, here, p1 is NOT an argument value, it is the parameter name! The double quotes just allow to indicate where your want to display the parameter. If you put in this name a new parameter, Hiptest will create automatically a new parameter in this action word.

If you go to this action word page, you can see that the name of the action word is the same than when you click on its call in the step editor:

You can also see that the parameter is defined in the Parameters table.

Be careful that this behavior is exactly the same when you add a new action word call. For example:

Capture%20du%202018-07-18%2016-06-21

The only difference, is that by default, as you create in the same time the action word and a step that calls this action word, Hiptest will use the name of the parameter as the value of the argument. So you will obtain that:

S%C3%A9lection_130

You can notice that if you do the same action but with the name of a data table column, Hiptest will detect automatically you want to use a variable as a value, and will put automatically the right format =columnName

For example :

Capture%20du%202018-07-18%2016-16-00

will give:

S%C3%A9lection_131

So to sum up:

  • Double quotes are used to display parameter place in the name of the action word
  • =format is used in the argument value of an action word call to use the data of a data table column

I hope this helps you

Regards