This topic provides an example of how you can use keywords with parameters. A keyword or a keyword sequence can have a combined total of 20 input and output parameters.
As a first step, create a keyword-driven test which contains the keywords that you want to use. You can do this by recording an entire keyword-driven test, or by creating a new keyword-driven test and by adding the keywords in the keyword-driven test editor.
The next step is to add the parameters to the keywords. To do this, open the test scripts of the keywords and add the parameters to the methods.
keyword Login() ...to
keyword Login(STRING UserName, STRING Password) ...
keyword GetCurrentUser() ...to
keyword GetCurrentUser(out STRING CurrentUser) ...
The keyword-driven test in the
Keyword-Driven Test Editor should look similar to the following:
Now you can specify actual values for the input parameters in the
Keyword-Driven Test Editor. To retrieve the value of the output parameter
UserName of the keyword
GetCurrentUser, provide a variable, for example
${current user}. You can then pass the value that is stored in the variable to subsequent keywords.