Skip to content

Commit

Permalink
test script to convert all wikis that are present.
Browse files Browse the repository at this point in the history
  • Loading branch information
MaxMelcher committed Jan 24, 2021
1 parent f2cdc65 commit b1a39fb
Show file tree
Hide file tree
Showing 3 changed files with 45 additions and 1 deletion.
3 changes: 2 additions & 1 deletion .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -30,4 +30,5 @@ _ReSharper*/
#Nuget packages folder
packages/
AzureDevOps.WikiPDFExport.Test/Tests/Azure-Platform-Design/
AzureDevOps.WikiPDFExport/.local-chromium/
AzureDevOps.WikiPDFExport/.local-chromium/
tests/*
43 changes: 43 additions & 0 deletions test-run.ps1
Original file line number Diff line number Diff line change
@@ -0,0 +1,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

#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" > $null

#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
Empty file added tests/.gitkeep
Empty file.

0 comments on commit b1a39fb

Please sign in to comment.