diff --git a/test-dotnet/action.yml b/test-dotnet/action.yml index 90bac589..81bc0a17 100644 --- a/test-dotnet/action.yml +++ b/test-dotnet/action.yml @@ -56,16 +56,25 @@ runs: aws-secret-access-key: ${{inputs.awsAccessKeySecret}} aws-region: ${{inputs.awsRegion}} - # GitHubActionsTestLogger nuget package should be installed in the test project - # coverlet.msbuild nuget package should be installed to generate coverage report + # GitHubActionsTestLogger nuget package should be installed in the test project. + # coverlet.msbuild nuget package should be installed to generate coverage report. + # The loop is necessary to prevent the following error: + # "Could not find a test logger with AssemblyQualifiedName, URI or FriendlyName 'GitHubActions'." - name: .NET Test shell: bash - run: dotnet test - --no-restore - --configuration Debug - --logger GitHubActions - --collect "XPlat Code Coverage" - --results-directory "TestResults/" + run: | + for f in $(find . -name "*.Tests.csproj"); + do + echo "testing project $f" && \ + csprojName=${f##*/} && \ + projectName="${csprojName/.csproj/}" && \ + dotnet test $f \ + --no-restore \ + --configuration Debug \ + --logger GitHubActions \ + --collect "XPlat Code Coverage" \ + --results-directory "TestResults/$projectName" + done # .NET Test puts the coverage file under a random directory [Guid]/coverage.cobertura.xml # That's why we locate the coverage file first and pass it to the upload script