-
Notifications
You must be signed in to change notification settings - Fork 110
/
data_driven.robot
45 lines (37 loc) · 1.59 KB
/
data_driven.robot
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
*** Settings ***
Documentation Example test cases using the data-driven testing approach.
...
... The _data-driven_ style works well when you need to repeat
... the same workflow multiple times.
...
... Tests use ``Calculate`` keyword created in this file, that in
... turn uses keywords in ``CalculatorLibrary.py``. An exception
... is the last test that has a custom _template keyword_.
...
... Notice that one of these tests fails on purpose to show how
... failures look like.
Test Template Calculate
Library CalculatorLibrary.py
*** Test Cases *** Expression Expected
Addition 12 + 2 + 2 16
2 + -3 -1
Subtraction 12 - 2 - 2 8
2 - -3 5
Multiplication 12 * 2 * 2 48
2 * -3 -6
Division 12 / 2 / 2 3
2 / -3 -1
Failing 1 + 1 3
Calculation error [Template] Calculation should fail
kekkonen Invalid button 'k'.
${EMPTY} Invalid expression.
1 / 0 Division by zero.
*** Keywords ***
Calculate
[Arguments] ${expression} ${expected}
Push buttons C${expression}=
Result should be ${expected}
Calculation should fail
[Arguments] ${expression} ${expected}
${error} = Should cause error C${expression}=
Should be equal ${expected} ${error} # Using `BuiltIn` keyword