Include si sistemul de depanare/testare headless din Teste\ (harness UI cu capturi, verificare de sintaxa prin compilare, wrappere text<->binar) si docs\depanare_testare_flora2roa.md.
75 lines
2.8 KiB
PowerShell
75 lines
2.8 KiB
PowerShell
<#
|
|
.SYNOPSIS
|
|
Ruleaza suita de teste FLORA2ROA (verificare de sintaxa + teste UI cu capturi).
|
|
|
|
.DESCRIPTION
|
|
Ordinea e cea din COMUN\docs\depanare_testare_vfp.md: intai compilarea de verificare (ieftina,
|
|
prinde sintaxa), apoi testele functionale pe fluxul real al utilizatorului.
|
|
|
|
Suitele NU se ruleaza in paralel: harness-ul isi omoara instantele vfp9 proprii inainte de
|
|
fiecare lansare (filtrat pe linia de comanda, instantele straine nu sunt atinse).
|
|
|
|
.PARAMETER Doar
|
|
Ruleaza numai testele al caror nume contine acest sir.
|
|
|
|
.PARAMETER FaraSintaxa
|
|
Sare peste verificarea de sintaxa.
|
|
|
|
.EXAMPLE
|
|
powershell -ExecutionPolicy Bypass -File Teste\ruleaza_teste.ps1
|
|
|
|
.EXAMPLE
|
|
powershell -ExecutionPolicy Bypass -File Teste\ruleaza_teste.ps1 -Doar export
|
|
#>
|
|
[CmdletBinding()]
|
|
param(
|
|
[string]$Doar,
|
|
[switch]$FaraSintaxa
|
|
)
|
|
$ErrorActionPreference = 'Stop'
|
|
$Teste = $PSScriptRoot
|
|
$Root = Split-Path $Teste -Parent
|
|
|
|
# nume test -> etichetele pasilor asteptate de vfp_ui_harness.ps1 (o captura per pas)
|
|
$suita = @(
|
|
@{ Prg = 'test_frm_import_ui.prg'; Steps = @('afisat', 'trace', 'date') }
|
|
@{ Prg = 'test_export_date.prg'; Steps = @('afisat', 'importat') }
|
|
)
|
|
if ($Doar) { $suita = $suita | Where-Object { $_.Prg -like "*$Doar*" } }
|
|
|
|
$rezultate = @()
|
|
|
|
if (-not $FaraSintaxa) {
|
|
Write-Host '=== Verificare de sintaxa (compilare headless) ===' -ForegroundColor Cyan
|
|
& (Join-Path $Teste 'verifica_sintaxa.ps1')
|
|
$rezultate += [pscustomobject]@{ Test = 'verifica_sintaxa'; Rezultat = $(if ($LASTEXITCODE -eq 0) { 'PASS' } else { 'FAIL' }) }
|
|
}
|
|
|
|
foreach ($t in $suita) {
|
|
$prg = Join-Path $Teste $t.Prg
|
|
if (-not (Test-Path $prg)) { Write-Warning "lipsa: $prg"; continue }
|
|
Write-Host ''
|
|
Write-Host ("=== {0} ===" -f $t.Prg) -ForegroundColor Cyan
|
|
|
|
# capturile fiecarui test in folderul lui, ca sa nu se suprascrie intre teste
|
|
$shots = Join-Path (Join-Path $Teste 'screenshots') ([IO.Path]::GetFileNameWithoutExtension($t.Prg))
|
|
& (Join-Path $Teste 'vfp_ui_harness.ps1') -TestPrg $prg -Steps $t.Steps -ShotsDir $shots -StepTimeoutSec 300
|
|
|
|
# verdictul il da testul: ultima linie "REZULTAT:" din log
|
|
$log = Join-Path $Teste ([IO.Path]::GetFileNameWithoutExtension($t.Prg) + '_log.txt')
|
|
$verdict = 'FARA LOG'
|
|
if (Test-Path $log) {
|
|
$linie = Select-String -Path $log -Pattern '^REZULTAT:' | Select-Object -Last 1
|
|
if ($linie) { $verdict = $linie.Line -replace '^REZULTAT:\s*', '' }
|
|
$failuri = @(Select-String -Path $log -Pattern '^FAIL:')
|
|
foreach ($f in $failuri) { Write-Warning $f.Line }
|
|
}
|
|
$rezultate += [pscustomobject]@{ Test = $t.Prg; Rezultat = $verdict }
|
|
}
|
|
|
|
Write-Host ''
|
|
Write-Host '=== SUMAR ===' -ForegroundColor Cyan
|
|
$rezultate | Format-Table -AutoSize
|
|
$nrFail = @($rezultate | Where-Object { $_.Rezultat -notlike 'PASS*' }).Count
|
|
exit ([int]($nrFail -gt 0))
|