$checkoutDir = "%teamcity.build.checkoutDir%"
$reports = "Reports\%system.teamcity.buildType.id%\%build.number%"
$reportsFolder = Join-Path $checkoutDir $reports
$folders = Get-ChildItem -Path $reportsFolder
$htmlContent = @"
Katalon Test Suite Collection Report Summary
"@
foreach($folder in $folders){
$xmlReportFile = Get-Item -Path (Join-Path $folder.fullName "JUnit_Report.xml" )
[xml]$report = Get-Content -Path $xmlReportFile
$testSuite = $report.testsuites.name
$newFolderName = "$testSuite-$($folder.name)"
Rename-Item -Path $folder.fullName -NewName $newFolderName
$htmlContent += @"
Katalon Reports for $testSuite
"@
}
$htmlContent += @"
"@
Set-Content -Path (Join-Path $reportsFolder "Report.html") -Value $htmlContent