Skip to content

Commit 920d155

Browse files
bennyvwCopilotGerwinLaagland
authored
Updated explanation for Keyword Matching (3.3.2) and examples for Free Named Arguments (2.5.1.2) (#80)
Important note: the image of the keyword documentation of the Set To Dictionary keyword has to be changed. I did not know how to create the 'splitted' image with the waves in between, so please help me out on that. ## Checklist - [x] Label set: `impact:major` or `impact:minor` - [x] PR title contains: Subject + Chapter scope + Topic - [x] One bullet per issue/change (see “Issues”) - [x] Each bullet includes a chapter (Ch. X or Ch. X.Y) - [x] Uses imperative verbs (Fix / Remove / Rephrase / Clarify) - [x] Descriptions are short (3–10 words) ## Major change checklist - [x] Exam Committee reviewed and confirmed exam impact (link/note): - [x] Training Providers informed (date + link): Training providers will be informed 21-04-2026 - [x] Effective date (countdown ends): YYYY-MM-DD ## Issues - #74 Run Process examples in paragraph 2.5.1.2 replaced by Set To Dictionary - #77 Explanation on how keyword matching works changed to reflect new functionality Herewith issues and are solved. --------- Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com> Co-authored-by: Gerwin <8427040+GerwinLaagland@users.noreply.github.com>
1 parent 7f8d557 commit 920d155

5 files changed

Lines changed: 34 additions & 23 deletions

File tree

README.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -96,7 +96,7 @@
9696
- [`2.5.1 Documented Keyword Information`](website/docs/chapter-02/05_keyword_interface.md#251-documented-keyword-information)
9797
- LO-2.5.1 (K1) Recall the information that can be found in a keyword documentation.
9898
- [`2.5.1.1 Example Keyword `Should Be Equal``](website/docs/chapter-02/05_keyword_interface.md#2511-example-keyword-should-be-equal)
99-
- [`2.5.1.2 Example Keyword `Run Process``](website/docs/chapter-02/05_keyword_interface.md#2512-example-keyword-run-process)
99+
- [`2.5.1.2 Example Keyword `Set To Dictionary``](website/docs/chapter-02/05_keyword_interface.md#2512-example-keyword-set-to-dictionary)
100100
- [`2.5.1.3 Example Keyword `Get Regexp Matches``](website/docs/chapter-02/05_keyword_interface.md#2513-example-keyword-get-regexp-matches)
101101
- [`2.5.2 Keyword Arguments`](website/docs/chapter-02/05_keyword_interface.md#252-keyword-arguments)
102102
- LO-2.5.2 (K2) Understand the difference between argument kinds.

website/docs/chapter-02/05_keyword_interface.md

Lines changed: 30 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -62,22 +62,23 @@ This keyword has 2 "Mandatory Arguments" and 6 "Optional Arguments".
6262
All of them can be called positionally or by name.
6363

6464

65-
### 2.5.1.2 Example Keyword `Run Process`
65+
### 2.5.1.2 Example Keyword `Set To Dictionary`
6666

67-
[Documentation of `Run Process` from `Process` library](https://robotframework.org/robotframework/latest/libraries/Process.html#Run%20Process)
67+
[Documentation of `Set To Dictionary` from `Collections` library](https://robotframework.org/robotframework/latest/libraries/Collections.html#Set%20To%20Dictionary)
6868

69-
`Run Process` is part of the Process library and is documented as follows:
69+
`Set To Dictionary` is part of the Collections library and is documented as follows:
7070

71-
![Run Process Keyword Documentation](/img/Run_Process_Docs.png)
71+
![Set To Dictionary Keyword Documentation](/img/Set_To_Dictionary_part_1.png)
7272

73-
This keyword has one Mandatory Argument `command` which can be called positionally or by name.
74-
The latter two arguments are optional.
73+
This keyword has one :term[Mandatory Argument] `dictionary` which can be called positionally or by name. See [Mandatory Args](../chapter-03/user_keyword).
74+
The latter two arguments are optional and can be used depending on the style of defining keys and values the user likes most.
7575

76-
The argument `arguments` is a :term[Variable Number of Positional Arguments] and can only be set by position.
76+
The argument `key_value_pairs` is a :term[Variable Number of Positional Arguments] and can only be set by position.
7777
Therefore, if it shall be set, all preceding arguments must be set by position as well.
7878
See [2.5.2.5 Variable Number of Positional Arguments](chapter-02/05_keyword_interface.md#2525-variable-number-of-positional-arguments) for more information about this kind of argument.
7979

80-
The argument `configuration` is a :term[Free Named Argument] and can only be set by names.
80+
The argument `items` is a :term[Free Named Argument] and can only be set by names.
81+
8182
See [2.5.2.7 Free Named Arguments](chapter-02/05_keyword_interface.md#2527-free-named-arguments) for more information about this kind of argument.
8283

8384

@@ -279,17 +280,26 @@ A special case of optional arguments that can only be set by their position are
279280
These are also referred to as `*args` or `*varargs` in Python.
280281
Some keywords need to collect a variable amount of values into one argument, because it is not possible to define the amount of values in advance.
281282

282-
One example for this kind of keyword is [2.5.1.2 Example Keyword `Run Process`](chapter-02/05_keyword_interface.md#2512-example-keyword-run-process) from the Process library.
283-
This keyword executes a `command` with variable amount of `arguments` and waits for the process to finish.
284-
Depending on the command to be executed different amount of arguments are needed for that command.
283+
One example for this kind of keyword is [2.5.1.2 Example Keyword `Set To Dictionary`](chapter-02/05_keyword_interface.md#2512-example-keyword-set-to-dictionary) from the Collections library.
284+
This keyword adds key and values to a `dictionary` with variable amount of `key_value_pairs`.
285+
Depending on the number of keys and values, different amount of arguments are needed.
285286

286-
This variable argument is marked with a single asterisk `*` before the argument name in the keyword documentation.
287+
This key_value_pairs argument is marked with a single asterisk `*` before the argument name in the keyword documentation.
287288

288-
When calling this keyword, the first positional argument is assigned to `command`, while all subsequent positional arguments are collected into `arguments`.
289+
When calling this keyword, the first positional argument is assigned to `dictionary`, while all subsequent positional arguments are collected into `key_value_pairs`.
289290
Because of this behavior, no additional positional arguments can be used after these :term[Variable Number of Positional Arguments].
290291
As a result, any arguments following these :term[Variable Number of Positional Arguments] must be named arguments,
292+
291293
regardless of whether they are mandatory or optional arguments with a default value.
292294

295+
Example adding items to a dictionary using the `key_value_pairs` argument:
296+
```robotframework
297+
*** Test Cases ***
298+
Dictionary Handling
299+
VAR &{mydict}
300+
Set To Dictionary ${mydict} key1 value1 key2 value2
301+
```
302+
293303
Also see [2.5.1.3 Example Keyword `Get Regexp Matches`](chapter-02/05_keyword_interface.md#2513-example-keyword-get-regexp-matches).
294304

295305

@@ -334,19 +344,20 @@ In this case all values given to the keyword as arguments, that do contain an un
334344

335345
Free named arguments are marked with two asterisks `**` before the argument name in the keyword documentation.
336346

337-
The example of the `Run Process` keyword also has a free named argument `** configuration`.
347+
The example of the `Set To Dictionary` keyword also has a free named argument `** items`.
338348

339-
When calling this keyword all named arguments that are not explicitly defined as argument names are collected into the `configuration` argument and will be available as a dictionary in the keyword implementation.
349+
When calling this keyword all named arguments that are not explicitly defined as argument names are collected into the `items` argument and will be available as a dictionary in the keyword implementation.
340350

341351
They are optional and can be omitted.
342352

343-
With this configuration it is possible to e.g. redirect the output of the process to a file or to set the working directory of the process.
353+
Using this `items` argument the key/value pairs can be given with an equal sign, like key=value.
344354

345-
Example redirecting stdout and stderr to a file:
355+
Example adding items to a dictionary using the `items` argument:
346356
```robotframework
347357
*** Test Cases ***
348-
Send 5 IPv4 Pings On Windows
349-
Run Process ping -n 5 -4 localhost stdout=ping_output.txt stderr=ping_error.txt
358+
Dictionary Handling
359+
VAR &{mydict}
360+
Set To Dictionary ${mydict} key1=value1 key2=value2
350361
```
351362

352363

website/docs/chapter-03/03_user_keyword.md

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -61,9 +61,9 @@ Also spaces and underscores will be ignored when matching keyword names.
6161
So the keywords `Login To System`, and `log_into_system` are considered identical.
6262

6363
To identify keywords that shall be executed, Robot Framework uses a matching algorithm that is case-insensitive and ignores spaces and underscores.
64-
- If then a full match is found, that keyword is used.
65-
- If no full match is found, the prefixes `Given`, `When`, `Then`, `And`, and `But` (case-insensitive), which are used in Behavior-Driven Specification style, are removed from the called keyword name to find a match.
66-
- If still no match is found, Robot Framework tries to match the name with keywords that have embedded arguments.
64+
- The prefixes Given, When, Then, And, and But (case-insensitive), which are used in Behavior-Driven Specification style, are removed from the called keyword name to find a match.
65+
- If no match is found, Robot Framework tries to match the name with keywords that have embedded arguments.
66+
- If still no match is found, a full match (including possible Given, When, Then, And and But) is tried.
6767

6868
By default, if not explicitly defined by the library developers, all Library Keywords are named in **Title Case** with capital letters at the beginning of each word, and spaces between words.
6969

-119 KB
Binary file not shown.
82.6 KB
Loading

0 commit comments

Comments
 (0)