1010# ###################################################################################
1111
1212Param (
13- [string ]$TestProjectFilter = ' Tests .*.csproj' ,
13+ [string ]$TestProjectFilter = ' *.Specs .*.csproj' ,
1414 [switch ]$ProdPackagesOnly = $false ,
1515 [string []]$ProductionAssemblies = @ (
1616 " Goodtocode.SemanticKernel.Core.Application" ,
@@ -34,21 +34,27 @@ $reportOutputPath = Join-Path $scriptPath "TestResults\Reports\$timestamp"
3434New-Item - ItemType Directory - Force - Path $coverageOutputPath
3535New-Item - ItemType Directory - Force - Path $reportOutputPath
3636
37- # Find tests for projects with 'Tests.*.csproj'
37+ $solutionFile = Get-ChildItem - Path $scriptPath - Filter * .sln - Recurse | Select-Object - First 1
38+ if ($null -eq $solutionFile ) {
39+ Write-Host " No solution file found. Exiting."
40+ exit 1
41+ }
42+ Write-Host " Building solution: $ ( $solutionFile.FullName ) "
43+ dotnet build $solutionFile.FullName
44+
3845$testProjects = Get-ChildItem $scriptPath - Filter $TestProjectFilter - Recurse
3946Write-Host " Found $ ( $testProjects.Count ) test projects."
4047foreach ($project in $testProjects ) {
4148 $testProjectPath = $project.FullName
4249 Write-Host " Running tests for project: $ ( $testProjectPath ) "
43-
50+ dotnet test $testProjectPath -- no - build
4451 $buildOutput = Join-Path - Path $project.Directory.FullName - ChildPath " bin\Debug\net9.0\$ ( $project.BaseName ) .dll"
4552 $coverageFile = Join-Path $coverageOutputPath " coverage.cobertura.xml"
4653 Write-Host " Analyzing code coverage for: $buildOutput "
4754 coverlet $buildOutput -- target " dotnet" -- targetargs " test $ ( $project.FullName ) --no-build" -- format cobertura -- output $coverageFile
4855
4956}
5057
51- # Generate HTML report
5258if ($ProdPackagesOnly ) {
5359 $assemblyFilters = ($ProductionAssemblies | ForEach-Object { " +$_ " }) -join " ;"
5460 $assemblyFilters = ($ProductionAssemblies | ForEach-Object { " +$_ " }) -join " ;"
0 commit comments