RobotFramework - keyword assign multiple variables, how to execute it only if condition?

2,111 views
Skip to first unread message

Patricio Iglesias

unread,
Nov 16, 2016, 7:49:36 AM11/16/16
to robotframework-users

Hello,


im facing this problem like a noob. It should be easy, but i dont find de way.


I have a Keyword that returns multiple values, reading from a file. I use it to set some variables like this:


${A} ${B} ${C} ${D} ${E} ObtainVariablesKeyword


Where ObtainVariablesKeyword has some code and finally:


[Return] ${A} ${B} ${C} ${D} ${E}


The thing is sometimes data is not in a file, instead user write it., So i'd like to run first example row only IF CONDITION.


Does anybody know how?


Run keyword if CONDITION KEYWORD, does not allow to put variables after condition, cause it waits for a keyword...


Thank You very much in advance.

Hélio Guilherme

unread,
Nov 16, 2016, 9:15:42 AM11/16/16
to robotframework-users
Then create your own keyword accepting variables.

--
You received this message because you are subscribed to the Google Groups "robotframework-users" group.
To unsubscribe from this group and stop receiving emails from it, send an email to robotframework-users+unsub...@googlegroups.com.
To post to this group, send email to robotframework-users@googlegroups.com.
Visit this group at https://groups.google.com/group/robotframework-users.
For more options, visit https://groups.google.com/d/optout.

Patricio Iglesias

unread,
Nov 17, 2016, 5:57:10 AM11/17/16
to robotframework-users
Thank you very much for your response.

Ill try to explain myself better.

I have this keyword:<CODE> ${A} ${B} ${C} ${D} ${E} ObtainVariablesKeyword </CODE>

Dont want to create global, or test variables for those values, i just want to initialite them depending on condition. For example:

<CODE>Run Keyword If ${flag}=${TRUE}  ${A} ${B} ${C} ${D} ${E} ObtainVariablesKeyword</CODE>

But this code fail, cause "Run Keyword If" waits for a keyword just after condition.



El miércoles, 16 de noviembre de 2016, 15:15:42 (UTC+1), Hélio Guilherme escribió:
Then create your own keyword accepting variables.
On Wed, Nov 16, 2016 at 12:49 PM, Patricio Iglesias <pigle...@gmail.com> wrote:

Hello,


im facing this problem like a noob. It should be easy, but i dont find de way.


I have a Keyword that returns multiple values, reading from a file. I use it to set some variables like this:


${A} ${B} ${C} ${D} ${E} ObtainVariablesKeyword


Where ObtainVariablesKeyword has some code and finally:


[Return] ${A} ${B} ${C} ${D} ${E}


The thing is sometimes data is not in a file, instead user write it., So i'd like to run first example row only IF CONDITION.


Does anybody know how?


Run keyword if CONDITION KEYWORD, does not allow to put variables after condition, cause it waits for a keyword...


Thank You very much in advance.

--
You received this message because you are subscribed to the Google Groups "robotframework-users" group.
To unsubscribe from this group and stop receiving emails from it, send an email to robotframework-users+unsub...@googlegroups.com.
To post to this group, send email to robotframe...@googlegroups.com.

Hélio Guilherme

unread,
Nov 17, 2016, 7:10:05 AM11/17/16
to robotframework-users
Hi see below.

On Thu, Nov 17, 2016 at 10:57 AM, Patricio Iglesias <pigle...@gmail.com> wrote:
Thank you very much for your response.

Ill try to explain myself better.

I have this keyword:<CODE> ${A} ${B} ${C} ${D} ${E} ObtainVariablesKeyword </CODE>

Dont want to create global, or test variables for those values, i just want to initialite them depending on condition. For example:

<CODE>Run Keyword If ${flag}=${TRUE}  ${A} ${B} ${C} ${D} ${E} ObtainVariablesKeyword</CODE>

But this code fail, cause "Run Keyword If" waits for a keyword just after condition

 The correct syntax should be:
<CODE>${A} ${B} ${C} ${D} ${E}=    Run Keyword If ${flag}=${TRUE}    ObtainVariablesKeyword</CODE>
Reply all
Reply to author
Forward
0 new messages