RF and multiple Editors, define parameters of a keyword how many spaces?

93 Views Asked by At

I'm still a novice on RF. I used multiple types of Editor recently to write my basic robot scripts (notepad++, Ride, Pycharm) and i'm not sure if i understand correctly the tabulated way of writing parameters of a keyword in Ride vs pycharm, notepad++. if i have a keyword with several parameters (optional and obligatory), i can either leave that parameter cell in Ride without any value and continue filling other parameters with values. in this case, the default value for that parameters is taken into account and if the default value is not defined, the Nothing value which is equal to ${EMPTY} is considered for that parameter. enter image description here

Is it correct? In pycharm & Notepd++, we don't have this tabulated visualisation of code. So i need to add 2 spaces to difine each parameter of my keyword. Does it mean that if i add 4 spaces after my keyword instead of 2 and add something, the editor(notepad++, pycharm) consider that the first parameter of my keyword is filled with nothing and i'm giving the second parameter? I don't think so? but why not please don't refer me directly to the RF userguide i 've already looked at it. I don't know anymore how many spaces i can add after mykeyword to point at its first parameter.it should be more than 1 of course but how many? Thanks a lot

2

There are 2 best solutions below

0
Helio On

The rule of thumb, is: Use always 2 or more spaces as a separator.

RIDE has an option to define the number of spaces when saving the file. But the mixing of different spacing counts is not advised (I really can't tell the behaviour). You should use the spacing consistensly. Choose 2 and use it in that file.

Other option that RIDE has, is the pipe separator "|". Although it is not visible in the editors, the resulting file will be pipe separated.

0
Pekka On

Robot Framework separates keywords and parameters with pipes or multiple spaces. The number of spaces does not matter if you have two or more. I prefer using spaces, and I like to line up variables because readability counts. I am writing my test cases using VSCode with Robot Code plugin.

Keyword argument handling works very much like in Python. If your keyword doesn't have a default value for an argument, you must supply it when you call. If you leave such a variable empty in RIDE, it will write a "" character which means an empty string.