-
Notifications
You must be signed in to change notification settings - Fork 0
/
ranged.yml
74 lines (69 loc) · 1.85 KB
/
ranged.yml
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
name: Range testsuite
vars:
rangedata:
- actual: foo
expected: foo
index: 0
- actual: bar
expected: bar
index: 1
testcases:
- name: range with hardcoded array
steps:
- type: exec
range:
- actual: hello
expected: hello
index: 0
- actual: world
expected: world
index: 1
script: echo "{{.index}} {{.value.actual}}"
assertions:
- result.code ShouldEqual 0
- result.systemout ShouldEqual "{{.value.index}} {{.value.expected}}"
- name: range with hardcoded string map
steps:
- type: exec
range:
foo:
actual: hello
expected: hello
key: foo
bar:
actual: world
expected: world
key: bar
script: echo "{{.key}} {{.value.actual}}"
assertions:
- result.code ShouldEqual 0
- result.systemout ShouldEqual "{{.value.key}} {{.value.expected}}"
- name: range with hardcoded iterations
steps:
- type: exec
range: 5
script: echo "{{.index}}"
assertions:
- result.code ShouldEqual 0
- result.systemout ShouldEqual "{{.value}}"
- name: range with templated items from current context or vars files
steps:
- type: exec
range: '{{.rangedata}}'
script: echo "{{.index}} {{.value.actual}}"
assertions:
- result.code ShouldEqual 0
- result.systemout ShouldEqual "{{.value.index}} {{.value.expected}}"
- name: range with templated items from a previous test case
steps:
- type: exec
script: echo '[{"actual":"hi", "expected":"hi", "index":0}, {"actual":"hey", "expected":"hey", "index":1}]'
vars:
previousResult:
from: result.systemout
- type: exec
range: '{{.previousResult}}'
script: echo "{{.index}} {{.value.actual}}"
assertions:
- result.code ShouldEqual 0
- result.systemout ShouldEqual "{{.value.index}} {{.value.expected}}"