-
Notifications
You must be signed in to change notification settings - Fork 67
/
test-run.ps1
43 lines (33 loc) · 1.35 KB
/
test-run.ps1
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
#build the project
dotnet build ".\AzureDevOps.WikiPDFExport\azuredevops-export-wiki.csproj"
#get the test folders
$wikis = Get-ChildItem -Recurse .\AzureDevOps.WikiPDFExport.Test\Tests -Depth 0 | ?{ $_.PSIsContainer }
$results = @()
#todo: read the previous result file to compare deltas
#todo: find a way to compare pdfs to find differences, maybe https://github.com/vslavik/diff-pdf
#iterate over each wiki in the test folder
foreach($wiki in $wikis)
{
Write-Output "Running: $($wiki.FullName)"
#run the converter
$output = dotnet run --project ".\AzureDevOps.WikiPDFExport\azuredevops-export-wiki.csproj" -- -p $wiki.FullName -o ".\tests\$($wiki.Name).pdf" --disableTelemetry
#extrac the time
$export = $output | ? {$_ -match 'Export done in (\d+):(\d+):(\d+).(\d+)'}
$null = $export -match 'Export done in (\d+):(\d+):(\d+).(\d+)'
$hours = $matches[1]
$minutes = $matches[2]
$seconds = $matches[3]
$millis = $matches[4]
Write-Output "$($wiki.Name): $($hours):$($minutes):$($seconds):$($millis)"
#persist the time for later comparision
$obj = [PSCustomObject]@{
Name = $wiki.Name
Hours = $hours
Minutes = $minutes
Seconds = $seconds
Millis = $millis
}
$results += $obj
}
#save the new results
$results | ConvertTo-Json | Set-Content -Path .\tests\results.json