e-nms_qa_automation/tests/e2e/run_tests_continuous.ps1

29 lines
965 B
PowerShell

$counter = 1
$logFile = "pytest_log.txt"
Write-Host "Test continue starting" -ForegroundColor Green
while ($true) {
$time = Get-Date -Format "HH:mm:ss"
Write-Host "RUN #$counter ($time)" -ForegroundColor Cyan
# Запускаем и видим вывод
pytest test_users_tab.py -v
$exitCode = $LASTEXITCODE
# Записываем в лог
"--- RUN #$counter ---" | Out-File $logFile -Append -Encoding UTF8
"Время: $(Get-Date)" | Out-File $logFile -Append -Encoding UTF8
pytest test_users_tab.py -v 2>&1 | Out-File $logFile -Append -Encoding UTF8
"Результат: $(if ($exitCode -eq 0) {'PASS'} else {'FAIL'})" | Out-File $logFile -Append -Encoding UTF8
" " | Out-File $logFile -Append -Encoding UTF8
if ($exitCode -ne 0) {
Write-Host "TEST FAIL!" -ForegroundColor Red
break
}
Write-Host "OK" -ForegroundColor Green
$counter++
Start-Sleep -Seconds 1
}