forked from lucadileo9/formazing
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathquick_test.bat
More file actions
308 lines (266 loc) Β· 8.96 KB
/
quick_test.bat
File metadata and controls
308 lines (266 loc) Β· 8.96 KB
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
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
@echo off
chcp 65001 > nul
echo.
echo π§ͺ FORMAZING QUICK TEST RUNNER
echo ===============================
echo π§ Setup ambiente...
if not exist ".env" (
echo β File .env non trovato!
echo π‘ Crea il file .env con TELEGRAM_BOT_TOKEN=your_token_here
goto :error
)
if not exist "tests\config\test_telegram_groups.json" (
echo β File tests\config\test_telegram_groups.json non trovato!
echo π‘ Configura i gruppi Telegram di test
goto :error
)
if not exist "tests\config\test_message_templates.yaml" (
echo β File tests\config\test_message_templates.yaml non trovato!
echo π‘ Configura i template messaggi di test
goto :error
)
if "%1"=="check" (
echo β
Tutti i file di configurazione sono presenti
echo π Verifica ambiente Python...
python -c "import pytest; print('β
pytest disponibile')" 2>nul || (
echo β pytest non installato
echo π‘ Installa con: pip install pytest
goto :error
)
echo π Ambiente configurato correttamente!
goto :end
)
if "%1"=="unit" (
echo β‘ Test unitari ^(1.2s^)...
python -m pytest tests/unit/ -v
goto :end
)
if "%1"=="notion" (
echo ποΈ Test NotionService ^(0.9s^)...
python -m pytest tests/unit/notion/ -v
goto :end
)
if "%1"=="format" (
echo π¨ Test formattazione messaggi...
python -m pytest tests/integration/test_real_telegram.py::TestRealTelegramIntegration::test_formatter_preview_messages -s -v --tb=short
goto :end
)
if "%1"=="safe" (
echo π‘οΈ Test sicuri ^(no invio^)...
python -m pytest tests/integration/test_real_telegram.py::TestRealTelegramIntegration::test_formatter_preview_messages -s -v --tb=short
goto :end
)
if "%1"=="interactive" (
echo π€ Test interattivi con conferme...
python -m pytest tests/integration/test_real_telegram.py::TestRealTelegramIntegration -s -v --tb=short
goto :end
)
if "%1"=="training" (
echo π€ Test invio formazione ^(REALE^)...
python -m pytest tests/integration/test_real_telegram.py::TestRealTelegramIntegration::test_send_training_notification_real -s -v --tb=short
goto :end
)
if "%1"=="feedback" (
echo π Test feedback ^(REALE^)...
python -m pytest tests/integration/test_real_telegram.py::TestRealTelegramIntegration::test_send_feedback_notification_real -s -v --tb=short
goto :end
)
if "%1"=="bot" (
echo π€ Test bot ^(REALE 60s^)...
python -m pytest tests/integration/test_real_telegram.py::TestRealTelegramIntegration::test_bot_commands_interactive -s -v --tb=short
goto :end
)
if "%1"=="real" (
echo π¨ Test tutti reali...
set /p confirm="β Continui? (S/N): "
if /i not "%confirm%"=="S" (
echo βοΈ Annullato
goto :end
)
python -m pytest tests/integration/test_real_telegram.py::TestRealTelegramIntegration -m real_telegram -s -v --tb=short
goto :end
)
if "%1"=="config" (
echo π Verifica connessioni...
python tests\e2e\test_real_config.py
goto :end
)
if "%1"=="preview" (
echo π¨ Test formattazione con dati reali...
python tests\e2e\test_real_formatting.py
goto :end
)
if "%1"=="send" (
echo π€ Test invio controllato...
echo β οΈ ATTENZIONE: PuΓ² inviare messaggi REALI dopo conferma!
python tests\e2e\test_real_send.py
goto :end
)
if "%1"=="workflow" (
echo π Test workflow completo ^(safe^)...
python tests\e2e\test_workflow.py --limit 3
goto :end
)
if "%1"=="workflow-real" (
echo π Workflow reale...
python tests\e2e\test_workflow.py --real --limit 2
goto :end
)
if "%1"=="microsoft" (
echo π· Test Microsoft Service ^(isolato^)...
python tests\e2e\test_real_microsoft.py
goto :end
)
if "%1"=="integration" (
echo π Test integrazione Notion β Microsoft...
python tests\integration\test_notion_microsoft_integration.py
goto :end
)
if "%1"=="teams" (
echo π
Test completo Microsoft Teams...
echo.
echo π Piano test Microsoft:
echo 1οΈβ£ Test service isolato ^(crea evento + email^)
echo 2οΈβ£ Test integrazione Notion β Microsoft
echo.
set /p confirm1="β Esegui test isolato Microsoft? (S/N): "
if /i "%confirm1%"=="S" (
echo π· Test Microsoft Service...
python tests\e2e\test_real_microsoft.py
if %errorlevel% neq 0 (
echo β Test Microsoft fallito
goto :error
)
echo β
Test Microsoft completato!
echo.
)
set /p confirm2="β Esegui test integrazione Notion β Microsoft? (S/N): "
if /i "%confirm2%"=="S" (
echo π Test integrazione...
python tests\integration\test_notion_microsoft_integration.py
if %errorlevel% neq 0 (
echo β Test integrazione fallito
goto :error
)
echo β
Test integrazione completato!
)
echo.
echo π Suite test Microsoft completata!
goto :end
)
if "%1"=="all" (
echo π SUITE COMPLETA PRE-COMMIT
echo.
echo π Piano di test:
echo 1οΈβ£ Test unitari ^(106 test, 1.2s^)
echo 2οΈβ£ Verifica connessioni ^(Notion + Telegram^)
echo 3οΈβ£ Test formattazione ^(template con dati reali^)
echo 4οΈβ£ Workflow simulazione ^(processo completo safe^)
echo.
echo π¦ STEP 1/4 - Test Unitari
echo ===========================
echo π― Esegue: 106 test unitari ^(NotionService + TelegramFormatter^)
echo.
echo β³ Attendi 5 secondi prima di iniziare...
timeout /t 5 > nul
echo β‘ Esecuzione test unitari...
python -m pytest tests/unit/ -v --tb=short
if %errorlevel% neq 0 (
echo β Test unitari falliti - Interrompo la suite
goto :error
)
echo β
Test unitari completati con successo!
echo.
:step2
echo π¨ STEP 2/4 - Verifica Connessioni
echo ====================================
echo π― Esegue: Test connessioni Notion + Telegram
echo π‘οΈ Sicurezza: Solo verifica connessioni, zero invii
echo π Risultato: Mostra stats formazioni e gruppi configurati
echo.
echo β³ Attendi 5 secondi prima di iniziare...
timeout /t 5 > nul
echo π Verifica connessioni...
python tests\e2e\test_real_config.py
if %errorlevel% neq 0 (
echo β Problemi connessioni - Verifica .env e config/
echo π‘ Vuoi continuare comunque? ^(Spesso non bloccante^)
set /p continueAnyway="β Continua con i test successivi? (S/N): "
if /i not "%continueAnyway%"=="S" (
echo βοΈ Suite interrotta dall'utente
goto :end
)
)
echo β
Connessioni verificate!
echo.
:step3
echo π© STEP 3/4 - Test Formattazione
echo =================================
echo π― Esegue: Formattazione template con 27+ formazioni reali
echo π‘οΈ Sicurezza: Solo generazione preview, zero invii
echo π Risultato: Valida template YAML e formattazione Markdown
echo.
echo β³ Attendi 5 secondi prima di iniziare...
timeout /t 5 > nul
echo π¨ Test formattazione messaggi...
python tests\e2e\test_real_formatting.py
if %errorlevel% neq 0 (
echo β Problemi formattazione template - Controlla config/
goto :error
)
echo β
Formattazione validata!
echo.
:step4
echo πͺ STEP 4/4 - Workflow Simulazione
echo ==================================
echo π― Esegue: Workflow completo con 3 formazioni reali
echo π‘οΈ Sicurezza: Simulazione completa, zero modifiche database
echo π Processo: Preview β Generazione codici β Formattazione β Report
echo.
echo β³ Attendi 5 secondi prima di iniziare...
timeout /t 5 > nul
echo π Workflow simulazione...
python tests\e2e\test_workflow.py --limit 3
if %errorlevel% neq 0 (
echo β Problemi workflow - Verifica logica integrazione
goto :error
)
echo β
Workflow simulato con successo!
echo.
:summary
echo π SUITE COMPLETA TERMINATA
echo β
Tutti i test sono stati completati con successo!
echo.
goto :end
)
if "%1"=="" (
echo.
echo π‘ Uso: quick_test.bat [COMANDO]
echo.
echo π― COMANDI PIΓ USATI:
echo unit - Test unitari (1.2s)
echo notion - Test NotionService (0.9s)
echo config - Verifica connessioni
echo workflow - Test workflow completo
echo all - Suite completa pre-commit (interattiva)
echo send - Invio controllato con conferma
echo.
echo π· TEST MICROSOFT TEAMS:
echo microsoft - Test Microsoft Service isolato
echo integration - Test integrazione Notion β Microsoft
echo teams - Suite completa test Microsoft
echo.
echo π Per lista completa comandi: docs/testing/README.md
echo.
goto :end
)
echo β Comando non riconosciuto: %1
echo π‘ Usa: quick_test.bat (senza parametri) per vedere l'help
goto :error
:error
echo.
echo β Errore nell'esecuzione
exit /b 1
:end
echo.
echo β
Operazione completata