New Keyword
Write ./mpRun -host=somehost.com -port= ... -sender= ${INTEGER} + 1
${INTEGER} = ${INTEGER} + 1
Repeat Keyword 9 times | New Keyword
Hope this helps!
Martin
> --
> You received this message because you are subscribed to the
> Google Groups "robotframework-users" group.
> To post to this group, send email to
> robotframe...@googlegroups.com.
> To unsubscribe from this group, send email to
> robotframework-u...@googlegroups.com.
> For more options, visit this group at
> http://groups.google.com/group/robotframework-users?hl=en.
>
>
Welcome aboard! Nice to hear things have worked pretty smoothly.
> I will try to explain it in more details:
>
> - I would like to send 10 emails using ssh library and sender id
> should be incremented by 1 each time an email is sent. The first email
> should have -sender = 1, the second should have -sender = 2, the third
> should have -sender = 3.....etc
>
> - At the same time and each time an email is send, the corresponding
> log file is accessed and greped for the -sender = id (which grows from
> 1 to 10 in my case)
>
> My question is: How to make the -senderId grow by 1 for each emil
> sent? As you can see I tried to put -sender= ${INTEGER} + 1 but it
> did not work unfortunately.
If you use `${INTEGER} + 1` in your test data, that `+ 1` is just
considered a static string that is catenated with the value of
`${INTEGER}`. If `${INTEGER}` is defined as a number, not string, you
could use `${INTEGER + 1}` which uses the so called extended variable
syntax [1] to get a value that is one bigger than variable alone. This
would not, however, increment the original value of the variable.
To increment the value you need to set it again. For that all of the
below approaches ought work. Notice that he second works even if the
variable type is originally a string, but the new value will be an
integer. The last one is handy if you need to make the new value
visible also outside the keyword where you use it.
${INTEGER} = Set Variable ${INTEGER + 1}
${INTEGER} = Evaluate ${INTEGER} + 1
Set Test Variable ${INTEGER} ${INTEGER + 1}
Finally, it might be easier to use `for in range` loop in your case
instead of `Repeat Keyword`.
[1] http://robotframework.googlecode.com/svn/tags/robotframework-2.5.5/doc/userguide/RobotFrameworkUserGuide.html#extended-variable-syntax
[2] http://robotframework.googlecode.com/svn/tags/robotframework-2.5.5/doc/userguide/RobotFrameworkUserGuide.html#for-in-range
Cheers,
.peke
--
Agile Tester/Developer/Consultant :: http://eliga.fi
Lead Developer of Robot Framework :: http://robotframework.org