-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathruntest.ps1
More file actions
54 lines (46 loc) · 2.03 KB
/
runtest.ps1
File metadata and controls
54 lines (46 loc) · 2.03 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
# Enable strict mode and clear the screen
Set-StrictMode -Version Latest
Clear-Host
Write-Host "-----------------------------------------" -ForegroundColor Cyan
Write-Host "Cleaning up old directories..." -ForegroundColor Yellow
Write-Host "-----------------------------------------" -ForegroundColor Cyan
# Remove directories if they exist
$dirs = @("allure-results", "logs", "results")
foreach ($dir in $dirs) {
if (Test-Path $dir) {
try {
Remove-Item -Recurse -Force $dir
Write-Host "Removed $dir"
} catch {
Write-Error "Failed to remove $dir"
exit 1
}
}
}
Write-Host "`n-----------------------------------------" -ForegroundColor Cyan
Write-Host "Running Robot Framework tests in parallel..." -ForegroundColor Yellow
Write-Host "-----------------------------------------" -ForegroundColor Cyan
# Run tests
$pabotCmd = "pabot --processes 3 --loglevel TRACE -d results --listener allure_robotframework:allure-results testcases"
Invoke-Expression $pabotCmd
if ($LASTEXITCODE -ne 0) {
Write-Error "❌ Robot tests failed with exit code $LASTEXITCODE"
exit $LASTEXITCODE
}
Write-Host "`n-----------------------------------------" -ForegroundColor Cyan
Write-Host "Generating Allure Report..." -ForegroundColor Yellow
Write-Host "-----------------------------------------" -ForegroundColor Cyan
# Generate Allure report
$allureGenerateCmd = "allure generate allure-results -o allure-report --clean"
Invoke-Expression $allureGenerateCmd
if ($LASTEXITCODE -ne 0) {
Write-Error "❌ Allure report generation failed with exit code $LASTEXITCODE"
exit $LASTEXITCODE
}
Write-Host "`n-----------------------------------------" -ForegroundColor Cyan
Write-Host "Opening Allure And Robot Framework Default Report in browser..." -ForegroundColor Yellow
Write-Host "-----------------------------------------" -ForegroundColor Cyan
# Open Robot Framework Default Report
Start-Process "results\report.html"
# Open Allure Report
Start-Process "allure" -ArgumentList "open", "allure-report"