I am instrumenting and collecting dotnet code coverage using steps given below. The dotnet service for which this coverage is getting collected is started as command prompt console application and not as registered windows service.
Steps for Instrumentation and collection:
- altcover --save --inplace --single -i "C:\Users\Admin\Desktop\BuildServices\OEAService"
- Starting dotnet service application
- Running testcases
- Stopping dotnet service using below powershell command:
if (Get-Process 'EAService' -ErrorAction SilentlyContinue) { Stop-Process -Name 'EAService' }
- altcover runner --collect -r "C:\Users\Admin\Desktop\BuildServices\OEAService" -c="C:\Users\Admin\Desktop\CodeCoverage\OEAService\coverage.xml"
When validated if all the visits were captured correctly in Cobertua coverage.xml, it was found that it is capturing only the hits which were captured on the console application i.e., main method and not rest of the logic/methods present in that EAService.exe.
But when i am registering this service and using it for starting and stopping the EAService, then it is capturing all the hits/visits properly in coverage file.
Can you please guide as if there are any changes required in my commands for collecting all the hits of EAService.exe.