b3b00 / coverlet-action

coverlet github action
MIT License
5 stars 4 forks source link

Multiple test projects not allowed #18

Closed nagesheaton closed 5 months ago

nagesheaton commented 5 months ago

I am trying to add multiple test projects to the task but it is throwing that the project doesn't exist. I assume separation will be done through "," between two projects.

Here are the complete logs of the task. Run b3b00/coverlet-action@1.2.5 with: testProject: Eaton.IoT.Asset/Eaton.IoT.Asset.Service.UnitTest/Eaton.IoT.Asset.Service.UnitTest.csproj,Eaton.IoT.Asset/Eaton.IoT.Asset.UnitTest/Eaton.IoT.Asset.UnitTest.csproj output: lcov.info outputFormat: lcov excludes: [program],[test]test. threshold: 80 env: DOTNET_ROOT: C:\Program Files\dotnet starting... output : lcov.info format lcov UT project Eaton.IoT.Asset/Eaton.IoT.Asset.Service.UnitTest/Eaton.IoT.Asset.Service.UnitTest.csproj,Eaton.IoT.Asset/Eaton.IoT.Asset.UnitTest/Eaton.IoT.Asset.UnitTest.csproj excludes [program],[test]test. includes [program],[test]test. threshold 80 debug run dotnet test -c Debug -p:coverletOutput=lcov.info -p:CollectCoverage=true -p:CoverletOutputFormat=lcov -p:Exclude=\"[program],[test]test.\" Eaton.IoT.Asset/Eaton.IoT.Asset.Service.UnitTest/Eaton.IoT.Asset.Service.UnitTest.csproj,Eaton.IoT.Asset/Eaton.IoT.Asset.UnitTest/Eaton.IoT.Asset.UnitTest.csproj dotnet failed Checking threshold 80 MSBUILD : error MSB1009: Project file does not exist. Switch: Eaton.IoT.Asset/Eaton.IoT.Asset.Service.UnitTest/Eaton.IoT.Asset.Service.UnitTest.csproj,Eaton.IoT.Asset/Eaton.IoT.Asset.UnitTest/Eaton.IoT.Asset.UnitTest.csproj

Error: dotnet test failure Command failed: dotnet test -c Debug -p:coverletOutput=lcov.info -p:CollectCoverage=true -p:CoverletOutputFormat=lcov -p:Exclude=\"[program],[test]test.\" Eaton.IoT.Asset/Eaton.IoT.Asset.Service.UnitTest/Eaton.IoT.Asset.Service.UnitTest.csproj,Eaton.IoT.Asset/Eaton.IoT.Asset.UnitTest/Eaton.IoT.Asset.UnitTest.csproj Error: error occured : coverage file not found at Eaton.IoT.Asset/Eaton.IoT.Asset.Service.UnitTest/Eaton.IoT.Asset.Service.UnitTest.csproj,Eaton.IoT.Asset/Eaton.IoT.Asset.UnitTest/lcov.info coverlet test done.

image

image

Kindly help..!

olduh29 commented 5 months ago

Hello @nagesheaton , this actions does not allow many unit test project.

b3b00 commented 5 months ago

If all pour test projets are in the samedi solution then you could try referencing the sln file instead of a csproj :

uses: b3b00/coverlet-action@1.2.5
with:
  testProject: 'mySolution.sln'
  output: 'lcov.info'
  outputFormat: 'lcov'
  excludes: '[program]*,[test]test.*'
  threshold: 80

Please tell me if that answer your question

nagesheaton commented 5 months ago

While running on Solution level I am getting two different reports. image

image

Is there any way to get consolidated test report?

nagesheaton commented 5 months ago

Also while running the Unittest in Visual Studio I am getting 90+ Coverage but <80 in this command. image

Is there any specific reason? Or I have to add anything here explicitly ? Since I am able to see the projects covered in both of the cases is different.

If you see the report in Visual Studio it covers different Projects. image

But some projects are missing in the coverlet command.

b3b00 commented 5 months ago

Maybe you have to exclude some projects from code coverage. Coverlet-action is only a gh action to use coverlet so for coverage report issue you should better look at how to use coverlet

nagesheaton commented 5 months ago

Thanks for the help. I will check and update here by Tomorrow.

olduh29 commented 5 months ago

@nagesheaton , could you share if you find a reason for coverage difference ? and if so what was the issue ? it could help future users.