Context
Arguments make keywords flexible. Instead of writing a keyword for every possible value, you write it once and pass in the values it needs. This is how reusable automation building blocks are created.
Theory
User keywords declare their arguments with the [Arguments] setting, followed by scalar variables such as ${name}. When the keyword is called, the caller provides values in the same order, and those values become available inside the keyword body.
Task
- Create a *** Keywords *** section.
- Create a keyword named Greet that takes one argument: ${name}.
- The keyword should log: Hello, ${name}!
- Create test cases Greet Robot and Greet Tester that call Greet with different names.
Checks
Run your code to see terminal output.
Context
Arguments make keywords flexible. Instead of writing a keyword for every possible value, you write it once and pass in the values it needs. This is how reusable automation building blocks are created.
Theory
User keywords declare their arguments with the [Arguments] setting, followed by scalar variables such as ${name}. When the keyword is called, the caller provides values in the same order, and those values become available inside the keyword body.
Task
- Create a *** Keywords *** section.
- Create a keyword named Greet that takes one argument: ${name}.
- The keyword should log: Hello, ${name}!
- Create test cases Greet Robot and Greet Tester that call Greet with different names.