File: robot_framework

package info (click to toggle)
ruby-rouge 4.6.1-1
  • links: PTS, VCS
  • area: main
  • in suites: forky, sid
  • size: 6,836 kB
  • sloc: ruby: 38,168; sed: 2,071; perl: 152; makefile: 8
file content (134 lines) | stat: -rw-r--r-- 3,875 bytes parent folder | download | duplicates (3)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
This text should be ignored.

*** Settings ***
Documentation    Example using the space separated plain text format.
Library          OperatingSystem
Library    Telnet    prompt=$    default_log_level=DEBUG

*** Variables ***
${MESSAGE}       Hello, world!

*** Test Cases ***
My Test
    [Documentation]    Example test
    Log    ${MESSAGE}
    My Keyword    /tmp

Another Test
    Should Be Equal    ${MESSAGE}    Hello, world!

Using backslash
    Do Something    first arg    \

Templated test case
    [Template]    Example keyword
    first argument    second argument

No teardown
    [Documentation]    Default setup, no teardown at all
    Do Something
    [Teardown]

Using variables
    [Documentation]    Setup and teardown specified using variables
    [Setup]    ${SETUP}
    Do Something
    [Teardown]    ${TEARDOWN}

Valid Login
    Given login page is open
    When valid username and password are inserted
    and credentials are submitted
    Then welcome page should be open

Example
    Keyword    &{DICT}    named=arg
    Keyword    positional    @{LIST}    &{DICT}
    Keyword    &{DICT}    &{ANOTHER}    &{ONE MORE}

List variable item
    Login    ${USER}[0]    ${USER}[1]
    Title Should Be    Welcome ${USER}[0]!

Negative index
    Log    ${LIST}[-1]

Index defined as variable
    Log    ${LIST}[${INDEX}]

Step
    Keyword    ${LIST}[::2]
    Keyword    ${LIST}[2:-1:2]

Multiple Values
    ${a}    ${b}    ${c} =    Return Three Values
    @{list} =    Return Three Values
    ${scalar}    @{rest} =    Return Three Values

Example
    FOR    ${animal}    IN    cat    dog
        Log    ${animal}
        Log    2nd keyword
    END
    Log    Outside loop

For-in-enumerate with two values per iteration
    FOR    ${index}    ${en}    ${fi}    IN ENUMERATE
    ...    cat      kissa
    ...    dog      koira
    ...    horse    hevonen
        Log    "${en}" in English is "${fi}" in Finnish (index: ${index})
    END

*** Tasks ***
Process invoice
    Read information from PDF
    Validate information
    Submit information to backend system
    Validate information is visible in web UI

*** Keywords ***
My Keyword
    [Arguments]    ${path}
    Directory Should Exist    ${path}

I execute "${cmd:[^"]+}"
    Run Process    ${cmd}    shell=True

| *** Settings ***   |
| Documentation      | Example using the pipe separated plain text format.
| Library            | OperatingSystem

| *** Variables ***  |
| ${MESSAGE}         | Hello, world!

| *** Test Cases *** |                 |              |
| My Test            | [Documentation] | Example test |
|                    | Log             | ${MESSAGE}   |
|                    | My Keyword      | /tmp         |
| Another Test       | Should Be Equal | ${MESSAGE}   | Hello, world!

| *** Keywords ***   |                        |         |
| My Keyword         | [Arguments]            | ${path} |
|                    | Directory Should Exist | ${path} |

| *** Test Cases *** |                 |                 |                      |
| Escaping Pipe      | ${file count} = | Execute Command | ls -1 *.txt \| wc -l |
|                    | Should Be Equal | ${file count}   | 42                   |

*** Settings ***
Documentation      This is documentation for this test suite.
...                This kind of documentation can often be get quite long...
Default Tags       default tag 1    default tag 2    default tag 3
...                default tag 4    default tag 5

*** Variable ***
@{LIST}            this     list     is      quite    long     and
...                items in it could also be long

*** Test Cases ***
Example
    [Tags]    you    probably    do    not    have    this    many
    ...       tags    in    real   life
    Do X    first argument    second argument    third argument
    ...    fourth argument    fifth argument    sixth argument