Skip to content

Commit

Permalink
add one more script
Browse files Browse the repository at this point in the history
  • Loading branch information
FlaviuTritean committed Dec 5, 2024
1 parent 40f6cff commit ff01294
Showing 1 changed file with 47 additions and 0 deletions.
47 changes: 47 additions & 0 deletions build/PowerShellScripts/UnitTestsReport.ps1
Original file line number Diff line number Diff line change
@@ -0,0 +1,47 @@
param(
[string]$directoryPath = ""
)

if (-not $directoryPath) {
$directoryPath = $env:SYSTEM_DEFAULTWORKINGDIRECTORY
}

if (-not (Test-Path -Path $directoryPath)) {
New-Item -ItemType Directory -Path $directoryPath -Force
}

$logFile = "$directoryPath\UnitTestsLog.txt"
$reportFile = "$directoryPath\UTinfo.txt"

function GetTitle{
param (
[string]$lineToSplit
)

$title = $lineToSplit -split ' '

return $title[-1]
}

Clear-Content -Path $reportFile -ErrorAction Ignore

Get-Content $logFile | ForEach-Object {
$line = $_

if ($line -match "Discovering:") {
Add-Content -Path $reportFile -Value (GetTitle -lineToSplit $line)
Add-Content -Path $reportFile -Value ""
}

if ($line -match "Passed ") {
Add-Content -Path $reportFile -Value $line
}

if ($line -match "Failed ") {
Add-Content -Path $reportFile -Value (" " + $line)
}

if ($line -match "Total time:") {
Add-Content -Path $reportFile -Value ""
}
}

0 comments on commit ff01294

Please sign in to comment.