-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathtest-config-MQTT.yaml
226 lines (223 loc) · 11.2 KB
/
test-config-MQTT.yaml
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
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
test_root:
max_points: 10.0
initial_steps:
# do promena ulozi nazev topic, ktery testovany klient vyuziva jako vstup
- set_var:
var_name: "in-topic"
value: "topic/device1/in"
# spusti mqtt broker
- create_mqtt_broker:
name: "broker-1"
port: 1883
- wait: 800
# vytovri mqtt klienta, ktereho bude vyuzivat pri testovani
- create_mqtt_client:
name: "client-1"
topics: ["topic/device1/out"]
broker_url: "tcp://localhost:1883"
- wait: 800
test_suites:
- test_suite:
name: "Testování přijímání zpráv vlhkosti půdy"
delay: 900
initial_steps:
# nastaveni filter akci pouze na zpravy humidity
- create_filter_action:
name: "client-1"
text: "humidity;"
mode: "contains"
case_sensitive: false
test_cases:
- test_case:
name: "Test automaticky odesílaných zpráv"
description: "V tomto testovacím případě bude testováno, zda v definovaných 10-ti sekundových intervalech přichází automaticky zpráva z naměřenou urovní vlhkosti půdy."
steps:
# spusti testovaneho klienta
- run_app_later:
command: "java -jar app/build/libs/app-all.jar 2493434934 0.1 0.1"
delay: 1500
# ceka dokud neprijde prvni zprava zacinajici "humidity;"
- wait_until:
module_name: "client-1"
time_out: 5000
# ceka na dalsi zpravu zacinajici "humidity;", mela prijit po 10 sec
- wait_until:
module_name: "client-1"
time_out: 11000
- test_case:
name: "Test vyžádání odesílání zprávy"
description: "V tomto testovacím případě bude testováno, zda na vyžádání testovaný klient odešle hodnotu vlhkosti půdy."
steps:
# spusti testovaneho klienta
- run_app_later:
command: "java -jar app/build/libs/app-all.jar 2493434934 0.1 0.1"
delay: 1500
# ceka dokud neprijde prvni zprava zacinajici "humidity;"
- wait_until:
module_name: "client-1"
time_out: 5000
# odesle zpravu pro vyzadani okamziteho zaslani hodnoty vlhkosti
- module_send:
name: "client-1"
message: "$in-topic:get-humidity"
- wait_until:
module_name: "client-1"
time_out: 5000
# v tuto chvili by meli byt v bufferu 2 prijate zpravy
- count_and_store:
var_name: "var-1"
module_name: "client-1"
- assert_equals:
var_name: "var-1"
value: 2
- test_suite:
name: "Testování řízení závlahy"
delay: 900
initial_steps:
# nastaveni filter akci pouze na zpravy status
- create_filter_action:
name: "client-1"
text: "status;"
mode: "contains"
case_sensitive: false
test_cases:
- test_case:
name: "Test získaní stavu zavlažování"
description: "Bude ověřováno, zda testovaný klient reaguje na zpravy pro získaní aktuálního stavu zavlažování."
steps:
# spusti testovaneho klienta
- run_app: "java -jar app/build/libs/app-all.jar 2493434934 0.1 0.1"
- wait: 1000
# odesle zpravu pro ziskani statusu
- module_send:
name: "client-1"
message: "$in-topic:get-status"
- wait_until:
module_name: "client-1"
time_out: 5000
# overi status (musi byt neaktivni)
- assert_string:
var_name: "client-1-action-msg"
expected: "status;irrigation_off"
mode: "contains"
case_sensitive: false
result: true
- test_case:
name: "Test řízení zavlažování"
description: "Bude ověřováno, zda testovaný klient reaguje na zprávy pro řízení zavlažování."
steps:
# spusti testovaneho klienta
- run_app: "java -jar app/build/libs/app-all.jar 2493434934 0.1 0.1"
- wait: 1000
# odesle zpravu pro spusteni zavlah
- module_send:
name: "client-1"
message: "$in-topic:start-irrigation"
delay: 200
- wait_until:
module_name: "client-1"
time_out: 5000
# overi status (musi byt aktivni)
- assert_string:
var_name: "client-1-action-msg"
expected: "status;irrigation_on"
mode: "contains"
case_sensitive: false
result: true
# odesle zpravu pro zastaveni zavlah
- module_send:
name: "client-1"
message: "$in-topic:stop-irrigation"
delay: 200
- wait_until:
module_name: "client-1"
time_out: 5000
# overi status (musi byt neaktivni)
- assert_string:
var_name: "client-1-action-msg"
expected: "status;irrigation_off"
mode: "contains"
case_sensitive: false
result: true
- test_case:
name: "Test automatického zastavení zavlažování"
description: "Bude testováno, zda testovaný klient automaticky zastaví zavlažování po 30 sekundách od poslední přijaté zprávy pro zahájení zavlažování."
steps:
# spusti testovaneho klienta
- run_app: "java -jar app/build/libs/app-all.jar 2493434934 0.1 0.1"
- wait: 1000
# odesle zpravu pro spusteni zavlah
- module_send:
name: "client-1"
message: "$in-topic:start-irrigation"
delay: 200
- wait_until:
module_name: "client-1"
time_out: 5000
# overi status (musi byt aktivni)
- assert_string:
var_name: "client-1-action-msg"
expected: "status;irrigation_on"
mode: "contains"
case_sensitive: false
result: true
# ceka na automaticke ukonceni zavlahy po 30 sekundach
- wait_until:
module_name: "client-1"
time_out: 34000
# overi status (musi byt neaktivni)
- assert_string:
var_name: "client-1-action-msg"
expected: "status;irrigation_off"
mode: "contains"
case_sensitive: false
result: true
- test_suite:
name: "Testování chybových zpráv"
delay: 900
initial_steps:
# nastaveni filter akci pouze na zpravy fault
- create_filter_action:
name: "client-1"
text: "fault;"
mode: "contains"
case_sensitive: false
test_cases:
- test_case:
name: "Test odeslání chybové hlášky čidla"
description: "Bude testováno, zda dojde k automatickému odeslání chybové hlašky při poruše čidla vlhkosti. Parametry pro simulaci v testované aplikaci jsou nastaveny tak, aby k chybě došlo co nejdříve."
steps:
# spusti se aplikace pro testovani
- run_app_later:
command: "java -jar app/build/libs/app-all.jar 2493434934 0.98 0.98"
delay: 1500
# ceka na prijeti zpravy s chybou
- wait_until:
module_name: "client-1"
time_out: 10000
- assert_string:
var_name: "client-1-action-msg"
expected: "fault;HUMIDITY_SENSOR"
mode: "contains"
case_sensitive: false
- test_case:
name: "Test odeslání chybové hlášky zalažování"
description: "Bude testováno, zda dojde k automatickému odeslání chybové hlašky při poruše zalažování. Parametry pro simulaci v testované aplikaci jsou nastaveny tak, aby k chybě došlo co nejdříve."
steps:
# spusti se aplikace pro testovani
- run_app: "java -jar app/build/libs/app-all.jar 2493434934 0.95 0.95"
- wait: 2000
# odesle zpravu pro spusteni zahlahy
- module_send:
name: "client-1"
message: "$in-topic:start-irrigation"
delay: 200
# ceka na prijeti zpravy s chybou
- wait_until:
module_name: "client-1"
time_out: 10000
- assert_string:
var_name: "client-1-action-msg"
expected: "fault;IRRIGATION_SYSTEM"
mode: "contains"
case_sensitive: false